[Xfce4-commits] <xfwm4:libxfce4ui> Simplify the tabwin/cycle code, Sanitize build with -Wall -Werror

Olivier Fourdan noreply at xfce.org
Sun Jan 10 10:24:14 CET 2010


Updating branch refs/heads/libxfce4ui
         to f7582c64227880e7bbfc623004f6f2413ebbdbbe (commit)
       from 8d9cb7fdabb0229e5db46646fdf54124e9307021 (commit)

commit f7582c64227880e7bbfc623004f6f2413ebbdbbe
Author: Olivier Fourdan <fourdan at xfce.org>
Date:   Thu Sep 10 14:11:17 2009 +0200

    Simplify the tabwin/cycle code,
    Sanitize build with -Wall -Werror

 settings-dialogs/tweaks-settings.c    |    2 +-
 settings-dialogs/workspace-settings.c |    2 +-
 settings-dialogs/xfwm4-settings.c     |   14 ++--
 src/Makefile.am                       |    1 -
 src/client.c                          |   84 +++++++++++++-------------
 src/client.h                          |   70 +++++++++------------
 src/compositor.c                      |   51 ++++++++--------
 src/cycle.c                           |   58 ++++++++---------
 src/cycle.h                           |    4 +-
 src/display.c                         |   62 +++++++++---------
 src/events.c                          |   22 +++---
 src/focus.c                           |   22 +++---
 src/focus.h                           |    2 +-
 src/frame.c                           |    7 +-
 src/hints.c                           |   23 +++----
 src/hints.h                           |    4 +-
 src/icons.c                           |    4 +-
 src/keyboard.c                        |    4 +-
 src/main.c                            |   70 ++++++++++----------
 src/moveresize.c                      |   80 ++++++++++++------------
 src/mypixmap.c                        |    9 ++-
 src/netwm.c                           |    6 +-
 src/parserc.c                         |    2 +-
 src/placement.c                       |   27 +++++---
 src/screen.c                          |   22 +++---
 src/screen.h                          |   21 +++---
 src/session.c                         |   26 ++++----
 src/settings.c                        |   16 +++---
 src/settings.h                        |    4 +-
 src/stacking.c                        |   84 +++++++++++++-------------
 src/stacking.h                        |    4 +-
 src/startup_notification.c            |    5 +-
 src/tabwin.c                          |  110 +++++++++++++++++++--------------
 src/tabwin.h                          |    7 +-
 src/terminate.c                       |    1 +
 src/transients.c                      |   56 ++++++++--------
 src/transients.h                      |    4 +-
 src/workspaces.c                      |   74 +++++++++++-----------
 src/workspaces.h                      |    6 +-
 39 files changed, 538 insertions(+), 532 deletions(-)

diff --git a/settings-dialogs/tweaks-settings.c b/settings-dialogs/tweaks-settings.c
index 8425c73..6fe028e 100644
--- a/settings-dialogs/tweaks-settings.c
+++ b/settings-dialogs/tweaks-settings.c
@@ -65,7 +65,7 @@ static const gchar *const modifier_list[] = {
 static void
 cb_easy_click_combo_box_changed (GtkComboBox *combo, XfconfChannel *channel)
 {
-    guint n;
+    gint n;
 
     n = 0;
     while (modifier_list[n])
diff --git a/settings-dialogs/workspace-settings.c b/settings-dialogs/workspace-settings.c
index ee69a1e..b7ae774 100644
--- a/settings-dialogs/workspace-settings.c
+++ b/settings-dialogs/workspace-settings.c
@@ -151,7 +151,7 @@ xfconf_workspace_names_changed(XfconfChannel *channel,
     GtkTreeView *treeview = user_data;
     GtkTreeModel *model = gtk_tree_view_get_model(treeview);
     WnckScreen *screen = wnck_screen_get_default();
-    gint i, n_workspaces;
+    guint i, n_workspaces;
     GPtrArray *names;
     GtkTreePath *path;
     GtkTreeIter iter;
diff --git a/settings-dialogs/xfwm4-settings.c b/settings-dialogs/xfwm4-settings.c
index 9cf089a..b857671 100644
--- a/settings-dialogs/xfwm4-settings.c
+++ b/settings-dialogs/xfwm4-settings.c
@@ -124,7 +124,7 @@ static void       xfwm_settings_hidden_frame_drag_data               (GtkWidget
                                                                       gint                  y,
                                                                       GtkSelectionData     *data,
                                                                       guint                 info,
-                                                                      guint                 time,
+                                                                      guint                 timestamp,
                                                                       XfwmSettings         *settings);
 static void       xfwm_settings_delete_indicator                     (GtkWidget            *widget);
 static void       xfwm_settings_create_indicator                     (GtkWidget            *widget,
@@ -136,7 +136,7 @@ static void       xfwm_settings_title_button_drag_data               (GtkWidget
                                                                       GdkDragContext       *drag_context,
                                                                       GtkSelectionData     *data,
                                                                       guint                 info,
-                                                                      guint                 time);
+                                                                      guint                 timestamp);
 static void       xfwm_settings_title_button_drag_begin              (GtkWidget            *widget,
                                                                       GdkDragContext       *drag_context);
 static void       xfwm_settings_title_button_drag_end                (GtkWidget            *widget,
@@ -1083,7 +1083,7 @@ xfwm_settings_active_frame_drag_data (GtkWidget        *widget,
                                       gint              y,
                                       GtkSelectionData *data,
                                       guint             info,
-                                      guint             time,
+                                      guint             timestamp,
                                       XfwmSettings     *settings)
 {
   GtkWidget *source;
@@ -1137,7 +1137,7 @@ xfwm_settings_active_frame_drag_motion (GtkWidget      *widget,
                                         GdkDragContext *drag_context,
                                         gint            x,
                                         gint            y,
-                                        guint           time,
+                                        guint           timestamp,
                                         XfwmSettings   *settings)
 {
   GtkWidget *active_box;
@@ -1196,7 +1196,7 @@ xfwm_settings_active_frame_drag_motion (GtkWidget      *widget,
 static void
 xfwm_settings_active_frame_drag_leave (GtkWidget      *widget,
                                        GdkDragContext *drag_context,
-                                       guint           time,
+                                       guint           timestamp,
                                        XfwmSettings   *settings)
 {
   g_return_if_fail (XFWM_IS_SETTINGS (settings));
@@ -1213,7 +1213,7 @@ xfwm_settings_hidden_frame_drag_data (GtkWidget        *widget,
                                       gint              y,
                                       GtkSelectionData *data,
                                       guint             info,
-                                      guint             time,
+                                      guint             timestamp,
                                       XfwmSettings     *settings)
 {
   GtkWidget *source;
@@ -1332,7 +1332,7 @@ xfwm_settings_title_button_drag_data (GtkWidget        *widget,
                                       GdkDragContext   *drag_context,
                                       GtkSelectionData *data,
                                       guint             info,
-                                      guint             time)
+                                      guint             timestamp)
 {
   gtk_widget_hide (widget);
   gtk_selection_data_set (data, gdk_atom_intern ("_xfwm4_button_layout", FALSE), 8,
diff --git a/src/Makefile.am b/src/Makefile.am
index e5f774d..e34d6f9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -90,7 +90,6 @@ xfwm4_CFLAGS =								\
 	$(RENDER_CFLAGS)						\
 	$(LIBSTARTUP_NOTIFICATION_CFLAGS)				\
 	$(COMPOSITOR_CFLAGS)						\
-	-I$(top_builddir)/common					\
 	-DPACKAGE_LOCALE_DIR=\"$(localedir)\"				\
 	-DDATADIR=\"$(datadir)\"					\
 	-DLIBEXECDIR=\"$(libexecdir)\"					\
diff --git a/src/client.c b/src/client.c
index 8502e9d..19354cd 100644
--- a/src/client.c
+++ b/src/client.c
@@ -246,7 +246,7 @@ clientUpdateAllFrames (ScreenInfo *screen_info, int mask)
 {
     Client *c;
     XWindowChanges wc;
-    int i;
+    guint i;
 
     g_return_if_fail (screen_info != NULL);
 
@@ -2239,7 +2239,7 @@ clientGetFromWindow (Client *c, Window w, unsigned short mode)
 }
 
 static void
-clientSetWorkspaceSingle (Client * c, int ws)
+clientSetWorkspaceSingle (Client * c, guint ws)
 {
     ScreenInfo *screen_info;
     DisplayInfo *display_info;
@@ -2275,21 +2275,21 @@ clientSetWorkspaceSingle (Client * c, int ws)
 }
 
 void
-clientSetWorkspace (Client * c, int ws, gboolean manage_mapping)
+clientSetWorkspace (Client * c, guint ws, gboolean manage_mapping)
 {
     Client *c2;
     GList *list_of_windows;
-    GList *index;
-    int previous_ws;
+    GList *list;
+    guint previous_ws;
 
     g_return_if_fail (c != NULL);
 
     TRACE ("entering clientSetWorkspace");
 
     list_of_windows = clientListTransientOrModal (c);
-    for (index = list_of_windows; index; index = g_list_next (index))
+    for (list = list_of_windows; list; list = g_list_next (list))
     {
-        c2 = (Client *) index->data;
+        c2 = (Client *) list->data;
 
         if (c2->win_workspace != ws)
         {
@@ -2351,15 +2351,15 @@ clientShow (Client * c, gboolean deiconify)
 {
     Client *c2;
     GList *list_of_windows;
-    GList *index;
+    GList *list;
 
     g_return_if_fail (c != NULL);
     TRACE ("entering clientShow \"%s\" (0x%lx)", c->name, c->window);
 
     list_of_windows = clientListTransientOrModal (c);
-    for (index = g_list_last (list_of_windows); index; index = g_list_previous (index))
+    for (list = g_list_last (list_of_windows); list; list = g_list_previous (list))
     {
-        c2 = (Client *) index->data;
+        c2 = (Client *) list->data;
         clientSetWorkspaceSingle (c2, c->win_workspace);
         /* Ignore request before if the window is not yet managed */
         if (!FLAG_TEST (c2->xfwm_flags, XFWM_FLAG_MANAGED))
@@ -2410,19 +2410,19 @@ clientWithdrawSingle (Client * c, GList *exclude_list, gboolean iconify)
 }
 
 void
-clientWithdraw (Client * c, int ws, gboolean iconify)
+clientWithdraw (Client * c, guint ws, gboolean iconify)
 {
     Client *c2;
     GList *list_of_windows;
-    GList *index;
+    GList *list;
 
     g_return_if_fail (c != NULL);
     TRACE ("entering clientWithdraw \"%s\" (0x%lx)", c->name, c->window);
 
     list_of_windows = clientListTransientOrModal (c);
-    for (index = list_of_windows; index; index = g_list_next (index))
+    for (list = list_of_windows; list; list = g_list_next (list))
     {
-        c2 = (Client *) index->data;
+        c2 = (Client *) list->data;
 
         /* Ignore request before if the window is not yet managed */
         if (!FLAG_TEST (c2->xfwm_flags, XFWM_FLAG_MANAGED))
@@ -2457,9 +2457,9 @@ clientWithdraw (Client * c, int ws, gboolean iconify)
 }
 
 void
-clientWithdrawAll (Client * c, int ws)
+clientWithdrawAll (Client * c, guint ws)
 {
-    GList *index;
+    GList *list;
     Client *c2;
     ScreenInfo *screen_info;
 
@@ -2468,9 +2468,9 @@ clientWithdrawAll (Client * c, int ws)
     TRACE ("entering clientWithdrawAll");
 
     screen_info = c->screen_info;
-    for (index = screen_info->windows_stack; index; index = g_list_next (index))
+    for (list = screen_info->windows_stack; list; list = g_list_next (list))
     {
-        c2 = (Client *) index->data;
+        c2 = (Client *) list->data;
 
         if ((c2 != c)
             && CLIENT_CAN_HIDE_WINDOW (c2)
@@ -2489,15 +2489,15 @@ clientWithdrawAll (Client * c, int ws)
 void
 clientClearAllShowDesktop (ScreenInfo *screen_info)
 {
-    GList *index;
+    GList *list;
 
     TRACE ("entering clientClearShowDesktop");
 
     if (screen_info->show_desktop)
     {
-        for (index = screen_info->windows_stack; index; index = g_list_next (index))
+        for (list = screen_info->windows_stack; list; list = g_list_next (list))
         {
-            Client *c = (Client *) index->data;
+            Client *c = (Client *) list->data;
             FLAG_UNSET (c->xfwm_flags, XFWM_FLAG_WAS_SHOWN);
         }
         screen_info->show_desktop = FALSE;
@@ -2509,7 +2509,7 @@ clientClearAllShowDesktop (ScreenInfo *screen_info)
 void
 clientToggleShowDesktop (ScreenInfo *screen_info)
 {
-    GList *index;
+    GList *list;
 
     TRACE ("entering clientToggleShowDesktop");
 
@@ -2518,9 +2518,9 @@ clientToggleShowDesktop (ScreenInfo *screen_info)
                     FOCUS_IGNORE_MODAL);
     if (screen_info->show_desktop)
     {
-        for (index = screen_info->windows_stack; index; index = g_list_next (index))
+        for (list = screen_info->windows_stack; list; list = g_list_next (list))
         {
-            Client *c = (Client *) index->data;
+            Client *c = (Client *) list->data;
             if ((c->type & WINDOW_REGULAR_FOCUSABLE)
                 && !FLAG_TEST (c->flags, CLIENT_FLAG_ICONIFIED | CLIENT_FLAG_SKIP_TASKBAR))
             {
@@ -2532,9 +2532,9 @@ clientToggleShowDesktop (ScreenInfo *screen_info)
     }
     else
     {
-        for (index = g_list_last(screen_info->windows_stack); index; index = g_list_previous (index))
+        for (list = g_list_last(screen_info->windows_stack); list; list = g_list_previous (list))
         {
-            Client *c = (Client *) index->data;
+            Client *c = (Client *) list->data;
             if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_WAS_SHOWN))
             {
                 clientShow (c, TRUE);
@@ -2689,12 +2689,12 @@ clientEnterContextMenuState (Client * c)
 }
 
 void
-clientSetLayer (Client * c, int l)
+clientSetLayer (Client * c, guint l)
 {
     ScreenInfo *screen_info;
     DisplayInfo *display_info;
     GList *list_of_windows = NULL;
-    GList *index = NULL;
+    GList *list = NULL;
     Client *c2 = NULL;
 
     g_return_if_fail (c != NULL);
@@ -2704,9 +2704,9 @@ clientSetLayer (Client * c, int l)
     display_info = screen_info->display_info;
 
     list_of_windows = clientListTransientOrModal (c);
-    for (index = list_of_windows; index; index = g_list_next (index))
+    for (list = list_of_windows; list; list = g_list_next (list))
     {
-        c2 = (Client *) index->data;
+        c2 = (Client *) list->data;
         if (c2->win_layer != l)
         {
             TRACE ("setting client \"%s\" (0x%lx) layer to %d", c2->name,
@@ -2847,7 +2847,7 @@ clientStick (Client * c, gboolean include_transients)
     DisplayInfo *display_info;
     Client *c2;
     GList *list_of_windows;
-    GList *index;
+    GList *list;
 
     g_return_if_fail (c != NULL);
     TRACE ("entering clientStick");
@@ -2858,9 +2858,9 @@ clientStick (Client * c, gboolean include_transients)
     if (include_transients)
     {
         list_of_windows = clientListTransientOrModal (c);
-        for (index = list_of_windows; index; index = g_list_next (index))
+        for (list = list_of_windows; list; list = g_list_next (list))
         {
-            c2 = (Client *) index->data;
+            c2 = (Client *) list->data;
             TRACE ("sticking client \"%s\" (0x%lx)", c2->name, c2->window);
             c2->win_state |= WIN_STATE_STICKY;
             FLAG_SET (c2->flags, CLIENT_FLAG_STICKY);
@@ -2889,7 +2889,7 @@ clientUnstick (Client * c, gboolean include_transients)
     DisplayInfo *display_info;
     Client *c2;
     GList *list_of_windows;
-    GList *index;
+    GList *list;
 
     g_return_if_fail (c != NULL);
     TRACE ("entering clientUnstick");
@@ -2901,9 +2901,9 @@ clientUnstick (Client * c, gboolean include_transients)
     if (include_transients)
     {
         list_of_windows = clientListTransientOrModal (c);
-        for (index = list_of_windows; index; index = g_list_next (index))
+        for (list = list_of_windows; list; list = g_list_next (list))
         {
-            c2 = (Client *) index->data;
+            c2 = (Client *) list->data;
             c2->win_state &= ~WIN_STATE_STICKY;
             FLAG_UNSET (c2->flags, CLIENT_FLAG_STICKY);
             setHint (display_info, c2->window, NET_WM_DESKTOP, (unsigned long) screen_info->current_ws);
@@ -3332,7 +3332,7 @@ clientUpdateAllOpacity (ScreenInfo *screen_info)
 {
     DisplayInfo *display_info;
     Client *c;
-    int i;
+    guint i;
 
     g_return_if_fail (screen_info != NULL);
 
@@ -3452,7 +3452,7 @@ void
 clientScreenResize(ScreenInfo *screen_info)
 {
     Client *c = NULL;
-    GList *index, *list_of_windows;
+    GList *list, *list_of_windows;
     XWindowChanges wc;
 
     list_of_windows = clientGetStackList (screen_info);
@@ -3463,20 +3463,20 @@ clientScreenResize(ScreenInfo *screen_info)
     }
 
     /* Revalidate client struts */
-    for (index = list_of_windows; index; index = g_list_next (index))
+    for (list = list_of_windows; list; list = g_list_next (list))
     {
-        c = (Client *) index->data;
+        c = (Client *) list->data;
         if (FLAG_TEST (c->flags, CLIENT_FLAG_HAS_STRUT))
         {
             clientValidateNetStrut (c);
         }
     }
 
-    for (index = list_of_windows; index; index = g_list_next (index))
+    for (list = list_of_windows; list; list = g_list_next (list))
     {
         unsigned long maximization_flags = 0L;
 
-        c = (Client *) index->data;
+        c = (Client *) list->data;
         if (!CONSTRAINED_WINDOW (c))
         {
             continue;
diff --git a/src/client.h b/src/client.h
index 954b74b..b16c0d0 100644
--- a/src/client.h
+++ b/src/client.h
@@ -260,6 +260,7 @@ struct _Client
     unsigned long win_state;
     unsigned long win_layer;
     unsigned long serial;
+    unsigned long initial_layer;
     Atom type_atom;
     Visual *visual;
     XSizeHints *size;
@@ -268,31 +269,30 @@ struct _Client
     Client *next;
     Client *prev;
     netWindowType type;
-    int x;
-    int y;
-    int width;
-    int height;
-    int depth;
-    int border_width;
-    int gravity;
-    int win_workspace;
+    gint x;
+    gint y;
+    gint width;
+    gint height;
+    gint depth;
+    gint border_width;
+    gint gravity;
+    guint win_workspace;
     unsigned int ignore_unmap;
-    int old_x;
-    int old_y;
-    int old_width;
-    int old_height;
-    int fullscreen_old_x;
-    int fullscreen_old_y;
-    int fullscreen_old_width;
-    int fullscreen_old_height;
-    int fullscreen_old_layer;
-    int previous_width;
-    int previous_height;
-    int initial_layer;
-    int ncmap;
-    int blink_iterations;
-    int button_status[BUTTON_COUNT];
-    int struts[STRUTS_SIZE];
+    gint old_x;
+    gint old_y;
+    gint old_width;
+    gint old_height;
+    gint fullscreen_old_x;
+    gint fullscreen_old_y;
+    gint fullscreen_old_width;
+    gint fullscreen_old_height;
+    gint fullscreen_old_layer;
+    gint previous_width;
+    gint previous_height;
+    gint ncmap;
+    gint blink_iterations;
+    gint button_status[BUTTON_COUNT];
+    gint struts[STRUTS_SIZE];
     gchar *hostname;
     gchar *name;
     guint32 user_time;
@@ -304,8 +304,8 @@ struct _Client
     gint fullscreen_monitors[4];
 
     /* Termination dialog */
-    int dialog_pid;
-    int dialog_fd;
+    gint dialog_pid;
+    gint dialog_fd;
     /* Timout for asynchronous icon update */
     guint icon_timeout_id;
     /* Timout for asynchronous frame update */
@@ -384,10 +384,10 @@ Client                  *clientGetFromWindow                    (Client *,
 void                     clientShow                             (Client *,
                                                                  gboolean);
 void                     clientWithdraw                         (Client *,
-                                                                 int,
+                                                                 guint,
                                                                  gboolean);
 void                     clientWithdrawAll                      (Client *,
-                                                                 int);
+                                                                 guint);
 void                     clientClearAllShowDesktop              (ScreenInfo *);
 void                     clientToggleShowDesktop                (ScreenInfo *);
 void                     clientActivate                         (Client *,
@@ -398,9 +398,9 @@ void                     clientKill                             (Client *);
 void                     clientTerminate                        (Client *);
 void                     clientEnterContextMenuState            (Client *);
 void                     clientSetLayer                         (Client *,
-                                                                 int);
+                                                                 guint);
 void                     clientSetWorkspace                     (Client *,
-                                                                 int,
+                                                                 guint,
                                                                  gboolean);
 void                     clientShade                            (Client *);
 void                     clientUnshade                          (Client *);
@@ -433,13 +433,6 @@ void                     clientSetOpacity                       (Client *,
 void                     clientIncOpacity                       (Client *);
 void                     clientDecOpacity                       (Client *);
 void                     clientScreenResize                     (ScreenInfo *);
-void                     clientMove                             (Client *,
-                                                                 XEvent *);
-void                     clientResize                           (Client *,
-                                                                 int,
-                                                                 XEvent *);
-void                     clientCycle                            (Client *,
-                                                                 XKeyEvent *);
 void                     clientButtonPress                      (Client *,
                                                                  Window,
                                                                  XButtonEvent *);
@@ -453,8 +446,5 @@ Client                  *clientGetLeader                        (Client *);
 #ifdef HAVE_LIBSTARTUP_NOTIFICATION
 char                    *clientGetStartupId                     (Client *);
 #endif /* HAVE_LIBSTARTUP_NOTIFICATION */
-#ifdef HAVE_XSYNC
-void                     clientXSyncRequest                     (Client *);
-#endif /* HAVE_XSYNC */
 
 #endif /* INC_CLIENT_H */
diff --git a/src/compositor.c b/src/compositor.c
index 99dbb3f..f9408c2 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -132,15 +132,15 @@ struct _CWindow
 static CWindow*
 find_cwindow_in_screen (ScreenInfo *screen_info, Window id)
 {
-    GList *index;
+    GList *list;
 
     g_return_val_if_fail (id != None, NULL);
     g_return_val_if_fail (screen_info != NULL, NULL);
     TRACE ("entering find_cwindow_in_screen");
 
-    for (index = screen_info->cwindows; index; index = g_list_next (index))
+    for (list = screen_info->cwindows; list; list = g_list_next (list))
     {
-        CWindow *cw = (CWindow *) index->data;
+        CWindow *cw = (CWindow *) list->data;
         if (cw->id == id)
         {
             return cw;
@@ -152,15 +152,15 @@ find_cwindow_in_screen (ScreenInfo *screen_info, Window id)
 static CWindow*
 find_cwindow_in_display (DisplayInfo *display_info, Window id)
 {
-    GSList *index;
+    GSList *list;
 
     g_return_val_if_fail (id != None, NULL);
     g_return_val_if_fail (display_info != NULL, NULL);
     TRACE ("entering find_cwindow_in_display");
 
-    for (index = display_info->screens; index; index = g_slist_next (index))
+    for (list = display_info->screens; list; list = g_slist_next (list))
     {
-        ScreenInfo *screen_info = (ScreenInfo *) index->data;
+        ScreenInfo *screen_info = (ScreenInfo *) list->data;
         CWindow *cw = find_cwindow_in_screen (screen_info, id);
         if (cw)
         {
@@ -1249,7 +1249,7 @@ paint_all (ScreenInfo *screen_info, XserverRegion region)
     DisplayInfo *display_info;
     XserverRegion paint_region;
     Display *dpy;
-    GList *index;
+    GList *list;
     gint screen_width;
     gint screen_height;
     gint screen_number;
@@ -1282,9 +1282,9 @@ paint_all (ScreenInfo *screen_info, XserverRegion region)
      * Painting from top to bottom, reducing the clipping area at each iteration.
      * Only the opaque windows are painted 1st.
      */
-    for (index = screen_info->cwindows; index; index = g_list_next (index))
+    for (list = screen_info->cwindows; list; list = g_list_next (list))
     {
-        cw = (CWindow *) index->data;
+        cw = (CWindow *) list->data;
         TRACE ("painting forward 0x%lx", cw->id);
         if (!WIN_IS_VISIBLE(cw) || !WIN_IS_DAMAGED(cw))
         {
@@ -1347,12 +1347,11 @@ paint_all (ScreenInfo *screen_info, XserverRegion region)
     /*
      * Painting from bottom to top, translucent windows and shadows are painted now...
      */
-    for (index = g_list_last(screen_info->cwindows); index; index = g_list_previous (index))
+    for (list = g_list_last(screen_info->cwindows); list; list = g_list_previous (list))
     {
-        CWindow *cw;
         XserverRegion shadowClip;
 
-        cw = (CWindow *) index->data;
+        cw = (CWindow *) list->data;
         shadowClip = None;
         TRACE ("painting backward 0x%lx", cw->id);
 
@@ -1525,7 +1524,7 @@ add_damage (ScreenInfo *screen_info, XserverRegion damage)
 static void
 fix_region (CWindow *cw, XserverRegion region)
 {
-    GList *index;
+    GList *list;
     ScreenInfo *screen_info;
     DisplayInfo *display_info;
 
@@ -1533,11 +1532,11 @@ fix_region (CWindow *cw, XserverRegion region)
     display_info = screen_info->display_info;
 
     /* Exclude opaque windows in front of the given area */
-    for (index = screen_info->cwindows; index; index = g_list_next (index))
+    for (list = screen_info->cwindows; list; list = g_list_next (list))
     {
         CWindow *cw2;
 
-        cw2 = (CWindow *) index->data;
+        cw2 = (CWindow *) list->data;
         if (cw2 == cw)
         {
             break;
@@ -2032,21 +2031,21 @@ restack_win (CWindow *cw, Window above)
     }
     else if (previous_above != above)
     {
-        GList *index;
+        GList *list;
 
-        for (index = screen_info->cwindows; index; index = g_list_next (index))
+        for (list = screen_info->cwindows; list; list = g_list_next (list))
         {
-            CWindow *cw2 = (CWindow *) index->data;
+            CWindow *cw2 = (CWindow *) list->data;
             if (cw2->id == above)
             {
                 break;
             }
         }
 
-        if (index != NULL)
+        if (list != NULL)
         {
             screen_info->cwindows = g_list_delete_link (screen_info->cwindows, sibling);
-            screen_info->cwindows = g_list_insert_before (screen_info->cwindows, index, cw);
+            screen_info->cwindows = g_list_insert_before (screen_info->cwindows, list, cw);
         }
     }
 }
@@ -2984,7 +2983,7 @@ compositorUnmanageScreen (ScreenInfo *screen_info)
 {
 #ifdef HAVE_COMPOSITOR
     DisplayInfo *display_info;
-    GList *index;
+    GList *list;
     gint i;
 
     g_return_if_fail (screen_info != NULL);
@@ -3008,9 +3007,9 @@ compositorUnmanageScreen (ScreenInfo *screen_info)
 #endif /* TIMEOUT_REPAINT */
 
     i = 0;
-    for (index = screen_info->cwindows; index; index = g_list_next (index))
+    for (list = screen_info->cwindows; list; list = g_list_next (list))
     {
-        CWindow *cw2 = (CWindow *) index->data;
+        CWindow *cw2 = (CWindow *) list->data;
         free_win_data (cw2, TRUE);
         i++;
     }
@@ -3196,7 +3195,7 @@ compositorRebuildScreen (ScreenInfo *screen_info)
 {
 #ifdef HAVE_COMPOSITOR
     DisplayInfo *display_info;
-    GList *index;
+    GList *list;
 
     g_return_if_fail (screen_info != NULL);
     TRACE ("entering compositorRepairScreen");
@@ -3207,9 +3206,9 @@ compositorRebuildScreen (ScreenInfo *screen_info)
         return;
     }
 
-    for (index = screen_info->cwindows; index; index = g_list_next (index))
+    for (list = screen_info->cwindows; list; list = g_list_next (list))
     {
-        CWindow *cw2 = (CWindow *) index->data;
+        CWindow *cw2 = (CWindow *) list->data;
         free_win_data (cw2, FALSE);
         init_opacity (cw2);
     }
diff --git a/src/cycle.c b/src/cycle.c
index c004574..345821c 100644
--- a/src/cycle.c
+++ b/src/cycle.c
@@ -37,6 +37,7 @@
 #include <gtk/gtk.h>
 #include <libxfce4util/libxfce4util.h>
 
+#include "cycle.h"
 #include "client.h"
 #include "focus.h"
 #include "frame.h"
@@ -51,7 +52,6 @@
 typedef struct _ClientCycleData ClientCycleData;
 struct _ClientCycleData
 {
-    Client *c;
     Tabwin *tabwin;
     Window wireframe;
 };
@@ -94,16 +94,15 @@ clientCycleCreateList (Client *c)
 {
     ScreenInfo *screen_info;
     Client *c2;
-    guint range;
-    GList *clients;
-    int i;
+    guint range, i;
+    GList *client_list;
 
     g_return_val_if_fail (c, NULL);
     TRACE ("entering clientCycleCreateList");
 
     screen_info = c->screen_info;
     range = clientGetCycleRange (screen_info);
-    clients = NULL;
+    client_list = NULL;
 
     for (c2 = c, i = 0; c && i < screen_info->client_count; i++, c2 = c2->next)
     {
@@ -121,15 +120,15 @@ clientCycleCreateList (Client *c)
              */
             if (c2->type != WINDOW_NORMAL)
                 continue;
-            if (g_list_find_custom (clients, c2, clientCompareApp))
+            if (g_list_find_custom (client_list, c2, clientCompareApp))
                 continue;
         }
 #endif
         TRACE ("clientCycleCreateList: adding %s", c2->name);
-        clients = g_list_append (clients, c2);
+        client_list = g_list_append (client_list, c2);
     }
 
-    return clients;
+    return client_list;
 }
 
 static void
@@ -167,12 +166,12 @@ clientCycleEventFilter (XEvent * xevent, gpointer data)
     TRACE ("entering clientCycleEventFilter");
 
     passdata = (ClientCycleData *) data;
-    if (passdata->c == NULL)
+    c = tabwinGetSelected(passdata->tabwin);
+    if (c == NULL)
     {
         return EVENT_FILTER_CONTINUE;
     }
 
-    c = passdata->c;
     screen_info = c->screen_info;
     display_info = screen_info->display_info;
     cancel = screen_info->params->keys[KEY_CANCEL].keycode;
@@ -197,7 +196,6 @@ clientCycleEventFilter (XEvent * xevent, gpointer data)
                 break; /* No need to go any further */
             gone |= (c == removed);
             c = tabwinRemoveClient(passdata->tabwin, removed);
-            passdata->c = c;
             status = EVENT_FILTER_CONTINUE;
             /* Walk through */
         case KeyPress:
@@ -210,11 +208,11 @@ clientCycleEventFilter (XEvent * xevent, gpointer data)
                     key = myScreenGetKeyPressed (screen_info, (XKeyEvent *) xevent);
                     /*
                      * We cannot simply check for key == KEY_CANCEL here because of the
-                     * mofidier being pressed, so we need to look at the keycode directly.
+                     * modidier being pressed, so we need to look at the keycode directly.
                      */
                     if (xevent->xkey.keycode == cancel)
                     {
-                        c2 = tabwinGetHead (passdata->tabwin);
+                        c2 = tabwinSelectHead (passdata->tabwin);
                         cycling = FALSE;
                     }
                     else if (key == KEY_CYCLE_REVERSE_WINDOWS)
@@ -230,7 +228,6 @@ clientCycleEventFilter (XEvent * xevent, gpointer data)
                     if (c2)
                     {
                         c = c2;
-                        passdata->c = c;
                     }
 
                     /* If last key press event had not our modifier pressed, finish cycling */
@@ -292,7 +289,7 @@ clientCycle (Client * c, XKeyEvent * ev)
     ScreenInfo *screen_info;
     DisplayInfo *display_info;
     ClientCycleData passdata;
-    GList *clients, *selected;
+    GList *client_list, *selected;
     guint cycle_range;
     gboolean g1, g2;
     int key;
@@ -303,8 +300,8 @@ clientCycle (Client * c, XKeyEvent * ev)
     screen_info = c->screen_info;
     display_info = screen_info->display_info;
 
-    clients = clientCycleCreateList (c);
-    if (!clients)
+    client_list = clientCycleCreateList (c);
+    if (!client_list)
     {
         return;
     }
@@ -319,7 +316,7 @@ clientCycle (Client * c, XKeyEvent * ev)
         gdk_beep ();
         myScreenUngrabKeyboard (screen_info, CurrentTime);
         myScreenUngrabPointer (screen_info, CurrentTime);
-        g_list_free (clients);
+        g_list_free (client_list);
 
         return;
     }
@@ -328,45 +325,40 @@ clientCycle (Client * c, XKeyEvent * ev)
 
     if (key == KEY_CYCLE_REVERSE_WINDOWS)
     {
-        selected = g_list_last (clients);
+        selected = g_list_last (client_list);
     }
     else
     {
-        selected = g_list_next (clients);
+        selected = g_list_next (client_list);
     }
-    passdata.c = (Client *) selected->data;
     passdata.wireframe = None;
 
     TRACE ("entering cycle loop");
     if (screen_info->params->cycle_draw_frame)
     {
-        passdata.wireframe = wireframeCreate (passdata.c);
+        passdata.wireframe = wireframeCreate ((Client *) selected->data);
     }
-    passdata.tabwin = tabwinCreate (&clients, selected, screen_info->params->cycle_workspaces);
+    passdata.tabwin = tabwinCreate (&client_list, selected, screen_info->params->cycle_workspaces);
     eventFilterPush (display_info->xfilter, clientCycleEventFilter, &passdata);
     gtk_main ();
     eventFilterPop (display_info->xfilter);
     TRACE ("leaving cycle loop");
-    tabwinDestroy (passdata.tabwin);
-    g_free (passdata.tabwin);
-    g_list_free (clients);
     if (passdata.wireframe)
     {
         wireframeDelete (screen_info, passdata.wireframe);
     }
     updateXserverTime (display_info);
 
-    if (passdata.c)
+    c = tabwinGetSelected (passdata.tabwin);
+    if (c)
     {
         Client *focused;
-        Client *sibling;
-        int workspace;
+        guint workspace;
 
-        c = passdata.c;
         workspace = c->win_workspace;
         focused = clientGetFocus ();
 
-        if ((focused) && (passdata.c != focused))
+        if ((focused) && (c != focused))
         {
             /* We might be able to avoid this if we are about to switch workspace */
             clientAdjustFullscreenLayer (focused, FALSE);
@@ -384,6 +376,10 @@ clientCycle (Client * c, XKeyEvent * ev)
         clientCycleFocusAndRaise (c);
     }
 
+    tabwinDestroy (passdata.tabwin);
+    g_free (passdata.tabwin);
+    g_list_free (client_list);
+
     /*
      * Use CurrentTime instead of actual last event time to make sure
      * that the grab is released in any case.
diff --git a/src/cycle.h b/src/cycle.h
index 8a53bf9..d3d29b7 100644
--- a/src/cycle.h
+++ b/src/cycle.h
@@ -36,6 +36,6 @@
 
 void                     clientCycle                            (Client *,
                                                                  XKeyEvent *);
-gboolean                 clientCycleWindow                      (void);
-gboolean                 clientCycleApp                         (void);
+gboolean                 clientSwitchWindow                     (void);
+gboolean                 clientSwitchApp                        (void);
 #endif /* INC_CYCLE_H */
diff --git a/src/display.c b/src/display.c
index 852a121..7ea5a98 100644
--- a/src/display.c
+++ b/src/display.c
@@ -431,12 +431,12 @@ myDisplayGetCursorRoot (DisplayInfo *display)
 }
 
 Cursor
-myDisplayGetCursorResize (DisplayInfo *display, guint index)
+myDisplayGetCursorResize (DisplayInfo *display, guint list)
 {
     g_return_val_if_fail (display, None);
-    g_return_val_if_fail (index < 8, None);
+    g_return_val_if_fail (list < 8, None);
 
-    return display->resize_cursor [index];
+    return display->resize_cursor [list];
 }
 
 
@@ -496,14 +496,14 @@ myDisplayRemoveClient (DisplayInfo *display, Client *c)
 Client *
 myDisplayGetClientFromWindow (DisplayInfo *display, Window w, unsigned short mode)
 {
-    GSList *index;
+    GSList *list;
 
     g_return_val_if_fail (w != None, NULL);
     g_return_val_if_fail (display != NULL, NULL);
 
-    for (index = display->clients; index; index = g_slist_next (index))
+    for (list = display->clients; list; list = g_slist_next (list))
     {
-        Client *c = (Client *) index->data;
+        Client *c = (Client *) list->data;
         if (clientGetFromWindow (c, w, mode))
         {
             return (c);
@@ -541,14 +541,14 @@ myDisplayRemoveScreen (DisplayInfo *display, ScreenInfo *screen)
 ScreenInfo *
 myDisplayGetScreenFromRoot (DisplayInfo *display, Window root)
 {
-    GSList *index;
+    GSList *list;
 
     g_return_val_if_fail (root != None, NULL);
     g_return_val_if_fail (display != NULL, NULL);
 
-    for (index = display->screens; index; index = g_slist_next (index))
+    for (list = display->screens; list; list = g_slist_next (list))
     {
-        ScreenInfo *screen = (ScreenInfo *) index->data;
+        ScreenInfo *screen = (ScreenInfo *) list->data;
         if (screen->xroot == root)
         {
             return screen;
@@ -562,13 +562,13 @@ myDisplayGetScreenFromRoot (DisplayInfo *display, Window root)
 ScreenInfo *
 myDisplayGetScreenFromNum (DisplayInfo *display, int num)
 {
-    GSList *index;
+    GSList *list;
 
     g_return_val_if_fail (display != NULL, NULL);
 
-    for (index = display->screens; index; index = g_slist_next (index))
+    for (list = display->screens; list; list = g_slist_next (list))
     {
-        ScreenInfo *screen = (ScreenInfo *) index->data;
+        ScreenInfo *screen = (ScreenInfo *) list->data;
         if (screen->screen == num)
         {
             return screen;
@@ -617,14 +617,14 @@ myDisplayGetScreenFromWindow (DisplayInfo *display, Window w)
 ScreenInfo *
 myDisplayGetScreenFromSystray (DisplayInfo *display, Window w)
 {
-    GSList *index;
+    GSList *list;
 
     g_return_val_if_fail (w != None, NULL);
     g_return_val_if_fail (display != NULL, NULL);
 
-    for (index = display->screens; index; index = g_slist_next (index))
+    for (list = display->screens; list; list = g_slist_next (list))
     {
-        ScreenInfo *screen = (ScreenInfo *) index->data;
+        ScreenInfo *screen = (ScreenInfo *) list->data;
         if (screen->systray == w)
         {
             return screen;
@@ -638,17 +638,17 @@ myDisplayGetScreenFromSystray (DisplayInfo *display, Window w)
 
 #ifdef HAVE_XSYNC
 Client *
-myDisplayGetClientFromXSyncAlarm (DisplayInfo *display, XSyncAlarm alarm)
+myDisplayGetClientFromXSyncAlarm (DisplayInfo *display, XSyncAlarm xalarm)
 {
-    GSList *index;
+    GSList *list;
 
-    g_return_val_if_fail (alarm != None, NULL);
+    g_return_val_if_fail (xalarm != None, NULL);
     g_return_val_if_fail (display != NULL, NULL);
 
-    for (index = display->clients; index; index = g_slist_next (index))
+    for (list = display->clients; list; list = g_slist_next (list))
     {
-        Client *c = (Client *) index->data;
-        if (alarm == c->xsync_alarm)
+        Client *c = (Client *) list->data;
+        if (xalarm == c->xsync_alarm)
         {
             return (c);
         }
@@ -662,14 +662,14 @@ myDisplayGetClientFromXSyncAlarm (DisplayInfo *display, XSyncAlarm alarm)
 ScreenInfo *
 myDisplayGetDefaultScreen (DisplayInfo *display)
 {
-    GSList *index;
+    GSList *list;
 
     g_return_val_if_fail (display != NULL, NULL);
 
-    index = display->screens;
-    if (index)
+    list = display->screens;
+    if (list)
     {
-        return (ScreenInfo *) index->data;
+        return (ScreenInfo *) list->data;
     }
 
     return NULL;
@@ -728,16 +728,16 @@ myDisplayGetCurrentTime (DisplayInfo *display)
 guint32
 myDisplayGetTime (DisplayInfo * display, guint32 timestamp)
 {
-    guint32 time;
+    guint32 display_timestamp;
 
-    time = timestamp;
-    if (time == (guint32) CurrentTime)
+    display_timestamp = timestamp;
+    if (display_timestamp == (guint32) CurrentTime)
     {
-        time = getXServerTime (display);
+        display_timestamp = getXServerTime (display);
     }
 
-    TRACE ("myDisplayGetTime gives timestamp=%u", (guint32) time);
-    return time;
+    TRACE ("myDisplayGetTime gives timestamp=%u", (guint32) display_timestamp);
+    return display_timestamp;
 }
 
 guint32
diff --git a/src/events.c b/src/events.c
index 99f56f3..a7cf162 100644
--- a/src/events.c
+++ b/src/events.c
@@ -438,7 +438,7 @@ handleKeyPress (DisplayInfo *display_info, XKeyEvent * ev)
             case KEY_MOVE_WORKSPACE_12:
                 handled = TRUE;
                 XAllowEvents (display_info->dpy, AsyncKeyboard, ev->time);
-                if (key - KEY_MOVE_WORKSPACE_1 < screen_info->workspace_count)
+                if ((guint) (key - KEY_MOVE_WORKSPACE_1) < screen_info->workspace_count)
                 {
                     clientRaise (c, None);
                     workspaceSwitch (screen_info, key - KEY_MOVE_WORKSPACE_1, c, TRUE, ev->time);
@@ -583,7 +583,7 @@ handleKeyPress (DisplayInfo *display_info, XKeyEvent * ev)
             status = EVENT_FILTER_REMOVE;
             handled = TRUE;
             XAllowEvents (display_info->dpy, AsyncKeyboard, ev->time);
-            if (key - KEY_WORKSPACE_1 < ev_screen_info->workspace_count)
+            if ((guint) (key - KEY_WORKSPACE_1) < ev_screen_info->workspace_count)
             {
                 workspaceSwitch (ev_screen_info, key - KEY_WORKSPACE_1, NULL, TRUE, ev->time);
             }
@@ -625,7 +625,7 @@ static void
 edgeButton (Client * c, int part, XButtonEvent * ev)
 {
     ScreenInfo *screen_info;
-    int state;
+    guint state;
 
     screen_info = c->screen_info;
     state = ev->state & MODIFIER_MASK;
@@ -786,7 +786,7 @@ button1Action (Client * c, XButtonEvent * ev)
 }
 
 static void
-titleButton (Client * c, int state, XButtonEvent * ev)
+titleButton (Client * c, guint state, XButtonEvent * ev)
 {
     ScreenInfo *screen_info;
     DisplayInfo *display_info;
@@ -916,7 +916,7 @@ handleButtonPress (DisplayInfo *display_info, XButtonEvent * ev)
     ScreenInfo *screen_info;
     Client *c;
     Window win;
-    int state, part;
+    guint state, part;
     gboolean replay;
 
     TRACE ("entering handleButtonPress");
@@ -1985,7 +1985,7 @@ handlePropertyNotify (DisplayInfo *display_info, XPropertyEvent * ev)
     if (ev->atom == display_info->atoms[NET_DESKTOP_NAMES])
     {
         gchar **names;
-        int items;
+        guint items;
 
         TRACE ("root has received a NET_DESKTOP_NAMES notify");
         if (getUTF8StringList (display_info, screen_info->xroot, NET_DESKTOP_NAMES, &names, &items))
@@ -2041,7 +2041,7 @@ handleClientMessage (DisplayInfo *display_info, XClientMessageEvent * ev)
         else if ((ev->message_type == display_info->atoms[WIN_LAYER]) && (ev->format == 32))
         {
             TRACE ("client \"%s\" (0x%lx) has received a WIN_LAYER event", c->name, c->window);
-            if (ev->data.l[0] != c->win_layer)
+            if ((unsigned long) ev->data.l[0] != c->win_layer)
             {
                 clientSetLayer (c, ev->data.l[0]);
             }
@@ -2112,7 +2112,7 @@ handleClientMessage (DisplayInfo *display_info, XClientMessageEvent * ev)
                 guint32 current = myDisplayGetLastUserTime (display_info);
 
                 TRACE ("Time of event received is %u, current XServer time is %u", (guint32) ev_time, (guint32) current);
-                if ((screen_info->params->prevent_focus_stealing) && TIMESTAMP_IS_BEFORE(ev_time, current))
+                if ((screen_info->params->prevent_focus_stealing) && TIMESTAMP_IS_BEFORE((guint32) ev_time, (guint32) current))
                 {
                     TRACE ("Setting WM_STATE_DEMANDS_ATTENTION flag on \"%s\" (0x%lx)", c->name, c->window);
                     FLAG_SET (c->flags, CLIENT_FLAG_DEMANDS_ATTENTION);
@@ -2212,7 +2212,7 @@ handleClientMessage (DisplayInfo *display_info, XClientMessageEvent * ev)
         }
         else if (ev->message_type == display_info->atoms[WM_PROTOCOLS])
         {
-            if (ev->data.l[0] == display_info->atoms[NET_WM_PING])
+            if ((Atom) ev->data.l[0] == display_info->atoms[NET_WM_PING])
             {
                 TRACE ("root has received a NET_WM_PING (pong) event\n");
                 clientReceiveNetWMPong (screen_info, (guint32) ev->data.l[1]);
@@ -2569,7 +2569,7 @@ initMenuEventWin (void)
 }
 
 static void
-show_window_menu (Client *c, gint px, gint py, guint button, guint32 time)
+show_window_menu (Client *c, gint px, gint py, guint button, guint32 timestamp)
 {
     ScreenInfo *screen_info;
     DisplayInfo *display_info;
@@ -2762,7 +2762,7 @@ show_window_menu (Client *c, gint px, gint py, guint button, guint32 time)
                          screen_info->workspace_names, screen_info->workspace_names_items,
                          display_info->xfilter, screen_info);
 
-    if (!menu_popup (menu, x, y, button, time))
+    if (!menu_popup (menu, x, y, button, timestamp))
     {
         TRACE ("Cannot open menu");
         gdk_beep ();
diff --git a/src/focus.c b/src/focus.c
index 32dabe5..a0daae5 100644
--- a/src/focus.c
+++ b/src/focus.c
@@ -78,18 +78,18 @@ clientDumpList (ScreenInfo *screen_info)
 #endif
 
 static ClientPair
-clientGetTopMostFocusable (ScreenInfo *screen_info, int layer, GList * exclude_list)
+clientGetTopMostFocusable (ScreenInfo *screen_info, guint layer, GList * exclude_list)
 {
     ClientPair top_client;
     Client *c;
-    GList *index;
+    GList *list;
 
     TRACE ("entering clientGetTopMostFocusable");
 
     top_client.prefered = top_client.highest = NULL;
-    for (index = screen_info->windows_stack; index; index = g_list_next (index))
+    for (list = screen_info->windows_stack; list; list = g_list_next (list))
     {
-        c = (Client *) index->data;
+        c = (Client *) list->data;
         TRACE ("*** stack window \"%s\" (0x%lx), layer %i", c->name,
             c->window, (int) c->win_layer);
 
@@ -119,7 +119,7 @@ clientGetTopMostFocusable (ScreenInfo *screen_info, int layer, GList * exclude_l
 }
 
 void
-clientFocusTop (ScreenInfo *screen_info, int layer, guint32 timestamp)
+clientFocusTop (ScreenInfo *screen_info, guint layer, guint32 timestamp)
 {
     ClientPair top_client;
     DisplayInfo *display_info;
@@ -634,8 +634,8 @@ clientInitFocusFlag (Client * c)
 {
     ScreenInfo *screen_info;
     Client *c2;
-    GList *index;
-    int workspace;
+    GList *list;
+    guint workspace;
 
     g_return_if_fail (c != NULL);
     TRACE ("entering clientSetFocus");
@@ -647,9 +647,9 @@ clientInitFocusFlag (Client * c)
 
     screen_info = c->screen_info;
     workspace = c->win_workspace;
-    for (index = screen_info->windows_stack; index; index = g_list_next (index))
+    for (list = screen_info->windows_stack; list; list = g_list_next (list))
     {
-        c2 = (Client *) index->data;
+        c2 = (Client *) list->data;
         if ((c2->win_workspace == workspace) && FLAG_TEST (c2->xfwm_flags, XFWM_FLAG_FOCUS))
         {
             FLAG_UNSET (c2->xfwm_flags, XFWM_FLAG_FOCUS);
@@ -742,7 +742,7 @@ void
 clientGrabMouseButtonForAll (ScreenInfo *screen_info)
 {
     Client *c;
-    int i;
+    guint i;
 
     g_return_if_fail (screen_info != NULL);
     TRACE ("entering clientGrabMouseButtonForAll");
@@ -758,7 +758,7 @@ void
 clientUngrabMouseButtonForAll (ScreenInfo *screen_info)
 {
     Client *c;
-    int i;
+    guint i;
 
     g_return_if_fail (screen_info != NULL);
     TRACE ("entering clientUngrabMouseButtonForAll");
diff --git a/src/focus.h b/src/focus.h
index 7a3df18..0dc8055 100644
--- a/src/focus.h
+++ b/src/focus.h
@@ -41,7 +41,7 @@
 #define FOCUS_TRANSITION                (1<<3)
 
 void                     clientFocusTop                         (ScreenInfo *,
-                                                                 int,
+                                                                 guint,
                                                                  guint32);
 gboolean                 clientFocusNew                         (Client *);
 gboolean                 clientSelectMask                       (Client *,
diff --git a/src/frame.c b/src/frame.c
index 3b315b3..3601029 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -847,9 +847,10 @@ frameDrawWin (Client * c)
     ScreenInfo *screen_info;
     FramePixmap frame_pix;
     xfwmPixmap *my_pixmap;
-    int state, i, j, x, button, left, right;
-    int top_width, bottom_width, left_height, right_height;
-    int button_x[BUTTON_COUNT];
+    gint state, x, button, left, right;
+    gint top_width, bottom_width, left_height, right_height;
+    gint button_x[BUTTON_COUNT];
+    guint i, j;
     gboolean requires_clearing;
     gboolean width_changed;
     gboolean height_changed;
diff --git a/src/hints.c b/src/hints.c
index 4d4d7a4..be1f322 100644
--- a/src/hints.c
+++ b/src/hints.c
@@ -151,7 +151,7 @@ unsigned int
 getWMProtocols (DisplayInfo *display_info, Window w)
 {
     Atom *protocols, *ap;
-    int i, n;
+    gint i, n;
     Atom atype;
     int aformat;
     unsigned int result;
@@ -197,7 +197,7 @@ getWMProtocols (DisplayInfo *display_info, Window w)
                     &aformat, &nitems, &bytes_remain,
                     (unsigned char **) &data)) == Success)
         {
-            for (i = 0, ap = (Atom *) data; i < nitems; i++, ap++)
+            for (i = 0, ap = (Atom *) data; (unsigned long) i < nitems; i++, ap++)
             {
                 if (*ap == display_info->atoms[WM_TAKE_FOCUS])
                 {
@@ -713,7 +713,7 @@ get_text_property (DisplayInfo *display_info, Window w, Atom a)
 }
 
 static gboolean
-getUTF8StringData (DisplayInfo *display_info, Window w, int atom_id, gchar **str_p, int *length)
+getUTF8StringData (DisplayInfo *display_info, Window w, int atom_id, gchar **str_p, guint *length)
 {
     Atom type;
     int format;
@@ -751,7 +751,7 @@ getUTF8StringData (DisplayInfo *display_info, Window w, int atom_id, gchar **str
 }
 
 gboolean
-getUTF8String (DisplayInfo *display_info, Window w, int atom_id, gchar **str_p, int *length)
+getUTF8String (DisplayInfo *display_info, Window w, int atom_id, gchar **str_p, guint *length)
 {
     char *xstr;
 
@@ -790,12 +790,11 @@ getUTF8String (DisplayInfo *display_info, Window w, int atom_id, gchar **str_p,
 }
 
 gboolean
-getUTF8StringList (DisplayInfo *display_info, Window w, int atom_id, gchar ***str_p, int *n_items)
+getUTF8StringList (DisplayInfo *display_info, Window w, int atom_id, gchar ***str_p, guint *n_items)
 {
     char *xstr, *ptr;
     gchar **retval;
-    guint i;
-    int length;
+    guint i, length;
 
     g_return_val_if_fail (((atom_id >= 0) && (atom_id < ATOM_COUNT)), FALSE);
 
@@ -912,7 +911,7 @@ gboolean
 getWindowName (DisplayInfo *display_info, Window w, gchar **name)
 {
     char *str;
-    int len;
+    guint len;
     gboolean status;
 
     TRACE ("entering getWindowName");
@@ -979,7 +978,7 @@ getClientLeader (DisplayInfo *display_info, Window window)
 }
 
 gboolean
-getNetWMUserTime (DisplayInfo *display_info, Window window, guint32 *time)
+getNetWMUserTime (DisplayInfo *display_info, Window window, guint32 *timestamp)
 {
     Atom actual_type;
     int actual_format;
@@ -998,12 +997,12 @@ getNetWMUserTime (DisplayInfo *display_info, Window window, guint32 *time)
         if ((data) && (actual_type == XA_CARDINAL)
             && (nitems == 1) && (bytes_after == 0))
         {
-            *time = *((guint32 *) data);
+            *timestamp= *((guint32 *) data);
             XFree (data);
             return TRUE;
         }
     }
-    *time = 0;
+    *timestamp = (guint32) CurrentTime;
 
     return FALSE;
 }
@@ -1332,7 +1331,7 @@ gboolean
 getWindowStartupId (DisplayInfo *display_info, Window w, gchar **startup_id)
 {
     char *str;
-    int len;
+    guint len;
 
     TRACE ("entering getWindowStartupId");
 
diff --git a/src/hints.h b/src/hints.h
index 3164fb7..96b110d 100644
--- a/src/hints.h
+++ b/src/hints.h
@@ -231,12 +231,12 @@ gboolean                 getUTF8String                          (DisplayInfo *,
                                                                  Window,
                                                                  int,
                                                                  gchar **,
-                                                                 int *);
+                                                                 guint *);
 gboolean                 getUTF8StringList                      (DisplayInfo *,
                                                                  Window,
                                                                  int,
                                                                  gchar ***,
-                                                                 int *);
+                                                                 guint *);
 gboolean                 getWindowProp                          (DisplayInfo *,
                                                                  Window,
                                                                  int,
diff --git a/src/icons.c b/src/icons.c
index 91dfa76..766eb5c 100644
--- a/src/icons.c
+++ b/src/icons.c
@@ -57,7 +57,7 @@ find_largest_sizes (gulong * data, gulong nitems, int *width, int *height)
         w = data[0];
         h = data[1];
 
-        if (nitems < ((w * h) + 2))
+        if (nitems < (gulong) ((w * h) + 2))
         {
             return FALSE;       /* not enough data */
         }
@@ -117,7 +117,7 @@ find_best_size (gulong * data, gulong nitems, int ideal_width, int ideal_height,
         w = data[0];
         h = data[1];
 
-        if (nitems < ((w * h) + 2))
+        if (nitems < (gulong) ((w * h) + 2))
         {
             break;              /* not enough data */
         }
diff --git a/src/keyboard.c b/src/keyboard.c
index 13576ab..3fb8d31 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -272,9 +272,7 @@ initModifiers (Display * dpy)
 {
     XModifierKeymap *modmap;
     KeySym *keymap;
-    unsigned int keycode;
-    int min_keycode;
-    int max_keycode;
+    int min_keycode, max_keycode, keycode;
     int keysyms_per_keycode;
     int i;
 
diff --git a/src/main.c b/src/main.c
index 1e4178e..fee8357 100644
--- a/src/main.c
+++ b/src/main.c
@@ -91,19 +91,19 @@ enum {
 static char revision[]="@(#)$ " PACKAGE " version " VERSION " revision " REVISION " $";
 #endif
 
-static DisplayInfo *display_info;
+static DisplayInfo *main_display_info = NULL;
 
 static void
 cleanUp (void)
 {
     GSList *screens;
 
-    g_return_if_fail (display_info);
+    g_return_if_fail (main_display_info);
 
     TRACE ("entering cleanUp");
 
-    eventFilterClose (display_info->xfilter);
-    for (screens = display_info->screens; screens; screens = g_slist_next (screens))
+    eventFilterClose (main_display_info->xfilter);
+    for (screens = main_display_info->screens; screens; screens = g_slist_next (screens))
     {
         ScreenInfo *screen_info_n = (ScreenInfo *) screens->data;
         myScreenClose (screen_info_n);
@@ -112,9 +112,9 @@ cleanUp (void)
     sn_close_display ();
     sessionFreeWindowStates ();
 
-    myDisplayClose (display_info);
-    g_free (display_info);
-    display_info = NULL;
+    myDisplayClose (main_display_info);
+    g_free (main_display_info);
+    main_display_info = NULL;
     xfconf_shutdown();
 }
 
@@ -128,11 +128,11 @@ handleSignal (int sig)
         case SIGINT:
         case SIGTERM:
             gtk_main_quit ();
-            display_info->quit = TRUE;
+            main_display_info->quit = TRUE;
             break;
         case SIGHUP:
         case SIGUSR1:
-            display_info->reload = TRUE;
+            main_display_info->reload = TRUE;
             break;
         case SIGSEGV:
             cleanUp ();
@@ -416,26 +416,26 @@ initialize (int argc, char **argv, gint compositor_mode, gboolean replace_wm)
 
     initMenuEventWin ();
     clientClearFocus (NULL);
-    display_info = myDisplayInit (gdk_display_get_default ());
+    main_display_info = myDisplayInit (gdk_display_get_default ());
 
 #ifdef HAVE_COMPOSITOR
     if (compositor_mode < COMPOSITOR_MODE_OFF)
     {
-        compositor_mode = get_default_compositor (display_info);
+        compositor_mode = get_default_compositor (main_display_info);
     }
 
     /* Disabling compositor from command line */
     if (!compositor_mode)
     {
-        display_info->enable_compositor = FALSE;
+        main_display_info->enable_compositor = FALSE;
     }
-    compositorSetCompositeMode (display_info, (compositor_mode == COMPOSITOR_MODE_MANUAL));
+    compositorSetCompositeMode (main_display_info, (compositor_mode == COMPOSITOR_MODE_MANUAL));
 #else /* HAVE_COMPOSITOR */
-    display_info->enable_compositor = FALSE;
+    main_display_info->enable_compositor = FALSE;
 #endif /* HAVE_COMPOSITOR */
     initWMStopIcons ();
 
-    initModifiers (display_info->dpy);
+    initModifiers (main_display_info->dpy);
 
     act.sa_handler = handleSignal;
     act.sa_flags = 0;
@@ -445,14 +445,14 @@ initialize (int argc, char **argv, gint compositor_mode, gboolean replace_wm)
     sigaction (SIGUSR1, &act, NULL);
     sigaction (SIGSEGV, &act, NULL);
 
-    nscreens = gdk_display_get_n_screens (display_info->gdisplay);
+    nscreens = gdk_display_get_n_screens (main_display_info->gdisplay);
     for(i = 0; i < nscreens; i++)
     {
         ScreenInfo *screen_info;
         GdkScreen *gscr;
 
-        gscr = gdk_display_get_screen (display_info->gdisplay, i);
-        screen_info = myScreenInit (display_info, gscr, MAIN_EVENT_MASK, replace_wm);
+        gscr = gdk_display_get_screen (main_display_info->gdisplay, i);
+        screen_info = myScreenInit (main_display_info, gscr, MAIN_EVENT_MASK, replace_wm);
 
         if (!screen_info)
         {
@@ -490,44 +490,44 @@ initialize (int argc, char **argv, gint compositor_mode, gboolean replace_wm)
                    compositing manager (used by WM tweaks to determine whether or not
                    show the "compositor" tab.
                  */
-                setAtomIdManagerOwner (display_info, XFWM4_COMPOSITING_MANAGER,
+                setAtomIdManagerOwner (main_display_info, XFWM4_COMPOSITING_MANAGER,
                                        screen_info->xroot, screen_info->xfwm4_win);
             }
         }
 
         sn_init_display (screen_info);
-        myDisplayAddScreen (display_info, screen_info);
-        setGnomeProtocols (display_info, screen_info->xroot, screen_info->xfwm4_win);
-        setHint (display_info, screen_info->xroot, WIN_SUPPORTING_WM_CHECK, screen_info->xfwm4_win);
-        setHint (display_info, screen_info->xroot, WIN_DESKTOP_BUTTON_PROXY, screen_info->xfwm4_win);
-        setHint (display_info, screen_info->xfwm4_win, WIN_DESKTOP_BUTTON_PROXY, screen_info->xfwm4_win);
-        getHint (display_info, screen_info->xroot, WIN_WORKSPACE, &ws);
+        myDisplayAddScreen (main_display_info, screen_info);
+        setGnomeProtocols (main_display_info, screen_info->xroot, screen_info->xfwm4_win);
+        setHint (main_display_info, screen_info->xroot, WIN_SUPPORTING_WM_CHECK, screen_info->xfwm4_win);
+        setHint (main_display_info, screen_info->xroot, WIN_DESKTOP_BUTTON_PROXY, screen_info->xfwm4_win);
+        setHint (main_display_info, screen_info->xfwm4_win, WIN_DESKTOP_BUTTON_PROXY, screen_info->xfwm4_win);
+        getHint (main_display_info, screen_info->xroot, WIN_WORKSPACE, &ws);
         screen_info->current_ws = (int) ws;
-        getGnomeDesktopMargins (display_info, screen_info->xroot, screen_info->gnome_margins);
-        setUTF8StringHint (display_info, screen_info->xfwm4_win, NET_WM_NAME, "Xfwm4");
-        setNetSupportedHint (display_info, screen_info->xroot, screen_info->xfwm4_win);
-        initNetDesktopInfo (display_info, screen_info->xroot, screen_info->current_ws,
+        getGnomeDesktopMargins (main_display_info, screen_info->xroot, screen_info->gnome_margins);
+        setUTF8StringHint (main_display_info, screen_info->xfwm4_win, NET_WM_NAME, "Xfwm4");
+        setNetSupportedHint (main_display_info, screen_info->xroot, screen_info->xfwm4_win);
+        initNetDesktopInfo (main_display_info, screen_info->xroot, screen_info->current_ws,
                                    screen_info->width,
                                    screen_info->height);
         workspaceUpdateArea (screen_info);
-        XSetInputFocus (display_info->dpy, screen_info->xfwm4_win, RevertToPointerRoot, CurrentTime);
+        XSetInputFocus (main_display_info->dpy, screen_info->xfwm4_win, RevertToPointerRoot, CurrentTime);
 
         clientFrameAll (screen_info);
 
         initGtkCallbacks (screen_info);
 
-        XDefineCursor (display_info->dpy, screen_info->xroot, myDisplayGetCursorRoot(display_info));
+        XDefineCursor (main_display_info->dpy, screen_info->xroot, myDisplayGetCursorRoot(main_display_info));
     }
 
     /* No screen to manage, give up */
-    if (!display_info->nb_screens)
+    if (!main_display_info->nb_screens)
     {
         return -1;
     }
-    display_info->xfilter = eventFilterInit ((gpointer) display_info);
-    eventFilterPush (display_info->xfilter, xfwm4_event_filter, (gpointer) display_info);
+    main_display_info->xfilter = eventFilterInit ((gpointer) main_display_info);
+    eventFilterPush (main_display_info->xfilter, xfwm4_event_filter, (gpointer) main_display_info);
 
-    return sessionStart (argc, argv, display_info);
+    return sessionStart (argc, argv, main_display_info);
 }
 
 int
diff --git a/src/moveresize.c b/src/moveresize.c
index f96087e..853d8d0 100644
--- a/src/moveresize.c
+++ b/src/moveresize.c
@@ -35,10 +35,11 @@
 #include <gdk/gdk.h>
 #include <gdk/gdkx.h>
 #include <gtk/gtk.h>
-#
+
 #include "client.h"
 #include "focus.h"
 #include "frame.h"
+#include "moveresize.h"
 #include "placement.h"
 #include "poswin.h"
 #include "screen.h"
@@ -63,15 +64,15 @@ struct _MoveResizeData
     gboolean is_transient;
     gboolean move_resized;
     gboolean released;
-    int button;
-    int cancel_x, cancel_y;
-    int cancel_w, cancel_h;
-    int cancel_workspace;
-    int mx, my;
-    int ox, oy;
-    int ow, oh;
-    int oldw, oldh;
-    int handle;
+    guint button;
+    gint cancel_x, cancel_y;
+    gint cancel_w, cancel_h;
+    guint cancel_workspace;
+    gint mx, my;
+    gint ox, oy;
+    gint ow, oh;
+    gint oldw, oldh;
+    gint handle;
     Poswin *poswin;
 };
 
@@ -187,7 +188,7 @@ clientSetHeight (Client * c, int h)
 static void
 clientMovePointer (DisplayInfo *display_info, gint dx, gint dy, guint repeat)
 {
-    gint i;
+    guint i;
     for (i = 0; i < repeat; ++i)
     {
         XWarpPointer (display_info->dpy, None, None, 0, 0, 0, 0, dx, dy);
@@ -271,7 +272,7 @@ clientSetHandle(MoveResizeData *passdata, int handle)
  */
 
 #define MAKE_MULT(a,b) ((b==1) ? (a) : (((int)((a)/(b))) * (b)) )
-void
+static void
 clientConstrainRatio (Client * c, int *w, int *h, int handle)
 {
 
@@ -364,7 +365,7 @@ clientDrawOutline (Client * c)
     }
 }
 
-gboolean
+static gboolean
 clientCheckOverlap (int s1, int e1, int s2, int e2)
 {
     /* Simple overlap test for an arbitary axis. -Cliff */
@@ -378,31 +379,31 @@ clientCheckOverlap (int s1, int e1, int s2, int e2)
     return FALSE;
 }
 
-int
+static int
 clientFindClosestEdgeX (Client *c, int edge_pos)
 {
     /* Find the closest edge of anything that we can snap to, taking
        frames into account, or just return the original value if nothing
        is within the snapping range. -Cliff */
-       
+
     Client *c2;
     ScreenInfo *screen_info;
-    int i, closest;
-    int snap_width;
+    guint i;
+    int snap_width, closest;
 
     screen_info = c->screen_info;
     snap_width = screen_info->params->snap_width;
     closest = edge_pos + snap_width + 2; /* This only needs to be out of the snap range to work. -Cliff */
-    
+
     for (c2 = screen_info->clients, i = 0; i < screen_info->client_count; c2 = c2->next, i++)
     {
         if (FLAG_TEST (c2->xfwm_flags, XFWM_FLAG_VISIBLE)  && (c2 != c) &&
             (((screen_info->params->snap_to_windows) && (c2->win_layer == c->win_layer))
              || ((screen_info->params->snap_to_border)
                   && FLAG_TEST (c2->flags, CLIENT_FLAG_HAS_STRUT)
-                  && FLAG_TEST (c2->xfwm_flags, XFWM_FLAG_VISIBLE))))  
+                  && FLAG_TEST (c2->xfwm_flags, XFWM_FLAG_VISIBLE))))
         {
-        
+
             if (clientCheckOverlap (c->y - frameTop (c) - 1, c->y + c->height + frameBottom (c) + 1, c2->y - frameTop (c) - 1, c2->y + c2->height + frameBottom (c) + 1))
             {
                 if (abs (c2->x - frameLeft (c2) - edge_pos) < abs (closest - edge_pos))
@@ -413,41 +414,41 @@ clientFindClosestEdgeX (Client *c, int edge_pos)
                 {
                     closest = (c2->x + c2->width) + frameRight (c2);
                 }
-            }            
+            }
         }
     }
-    
+
     if (abs (closest - edge_pos) > snap_width)
     {
         closest = edge_pos;
     }
-    
+
     return closest;
 }
 
-int
+static int
 clientFindClosestEdgeY (Client *c, int edge_pos)
 {
     /* This function is mostly identical to the one above, but swaps the
        axes. If there's a better way to do it than this, I'd like to
        know. -Cliff */
-       
+
     Client *c2;
     ScreenInfo *screen_info;
-    int i, closest;
-    int snap_width;
+    guint i;
+    int snap_width, closest;
 
     screen_info = c->screen_info;
     snap_width = screen_info->params->snap_width;
     closest = edge_pos + snap_width + 1; /* This only needs to be out of the snap range to work. -Cliff */
-    
+
     for (c2 = screen_info->clients, i = 0; i < screen_info->client_count; c2 = c2->next, i++)
     {
         if (FLAG_TEST (c2->xfwm_flags, XFWM_FLAG_VISIBLE)  && (c2 != c) &&
             (((screen_info->params->snap_to_windows) && (c2->win_layer == c->win_layer))
              || ((screen_info->params->snap_to_border)
                   && FLAG_TEST (c2->flags, CLIENT_FLAG_HAS_STRUT)
-                  && FLAG_TEST (c2->xfwm_flags, XFWM_FLAG_VISIBLE))))  
+                  && FLAG_TEST (c2->xfwm_flags, XFWM_FLAG_VISIBLE))))
         {
 
             if (clientCheckOverlap (c->x - frameLeft (c) - 1, c->x + c->width + frameRight (c) + 1, c2->x - frameLeft (c) - 1, c2->x + c2->width + frameRight (c) + 1))
@@ -460,15 +461,15 @@ clientFindClosestEdgeY (Client *c, int edge_pos)
                 {
                     closest = (c2->y + c2->height) + frameBottom (c2);
                 }
-            }            
+            }
         }
     }
-    
+
     if (abs (closest - edge_pos) > snap_width)
     {
         closest = edge_pos;
     }
-    
+
     return closest;
 }
 
@@ -477,7 +478,8 @@ clientSnapPosition (Client * c, int prev_x, int prev_y)
 {
     ScreenInfo *screen_info;
     Client *c2;
-    int cx, cy, i, delta;
+    guint i;
+    int cx, cy, delta;
     int disp_x, disp_y, disp_max_x, disp_max_y;
     int frame_x, frame_y, frame_height, frame_width;
     int frame_top, frame_left, frame_right, frame_bottom;
@@ -1413,7 +1415,7 @@ clientResizeEventFilter (XEvent * xevent, gpointer data)
 
             /* Attempt to snap the right edge to something. -Cliff */
             c->width = clientFindClosestEdgeX (c, c->x + c->width + frameRight (c)) - c->x - frameRight (c);
-            
+
         }
         if (!FLAG_TEST (c->flags, CLIENT_FLAG_SHADED))
         {
@@ -1424,7 +1426,7 @@ clientResizeEventFilter (XEvent * xevent, gpointer data)
             else if (move_bottom)
             {
                 c->height = passdata->oh + (xevent->xmotion.y_root - passdata->my);
-                
+
                 /* Attempt to snap the bottom edge to something. -Cliff */
                 c->height = clientFindClosestEdgeY (c, c->y + c->height + frameBottom (c)) - c->y - frameBottom (c);
             }
@@ -1435,12 +1437,12 @@ clientResizeEventFilter (XEvent * xevent, gpointer data)
         if (move_left)
         {
             c->x = c->x - (c->width - passdata->oldw);
-            
+
             /* Snap the left edge to something. -Cliff */
             right_edge = c->x + c->width;
             c->x = clientFindClosestEdgeX (c, c->x - frameLeft (c)) + frameLeft (c);
             c->width = right_edge - c->x;
-            
+
             frame_x = frameX (c);
         }
 
@@ -1448,12 +1450,12 @@ clientResizeEventFilter (XEvent * xevent, gpointer data)
         if (!FLAG_TEST (c->flags, CLIENT_FLAG_SHADED) && move_top)
         {
             c->y = c->y - (c->height - passdata->oldh);
-            
+
             /* Snap the top edge to something. -Cliff */
             bottom_edge = c->y + c->height;
             c->y = clientFindClosestEdgeY (c, c->y - frameTop (c)) + frameTop (c);
             c->height = bottom_edge - c->y;
-            
+
             frame_y = frameY (c);
         }
 
diff --git a/src/mypixmap.c b/src/mypixmap.c
index a77241e..343f088 100644
--- a/src/mypixmap.c
+++ b/src/mypixmap.c
@@ -346,7 +346,7 @@ xpm_extract_color (const gchar *buffer, xfwmColorSymbol *color_sym)
     gint new_key;
     gint key;
     gint current_key;
-    gint space;
+    guint space;
 
     p = &buffer[0];
     space = 128;
@@ -367,7 +367,7 @@ xpm_extract_color (const gchar *buffer, xfwmColorSymbol *color_sym)
         for (r = word;
                  (*p != '\0') &&
                  (!g_ascii_isspace (*p)) &&
-                 (r - word < sizeof (word) - 1);
+                 (r - word < (gchar) sizeof (word) - 1);
              p++, r++)
         {
                 *r = *p;
@@ -519,7 +519,8 @@ pixbuf_create_from_xpm (gpointer handle, xfwmColorSymbol *color_sym)
     const gchar *buffer;
     gchar *name_buf;
     gint w, h, n_col, cpp, items;
-    gint cnt, xcnt, ycnt, wbytes, n;
+    gint cnt, xcnt, ycnt;
+    guint wbytes, n;
     GHashTable *color_hash;
     XPMColor *colors, *color, *fallbackcolor;
     guchar *pixtmp;
@@ -547,7 +548,7 @@ pixbuf_create_from_xpm (gpointer handle, xfwmColorSymbol *color_sym)
         (cpp >= 32) ||
         (n_col <= 0) ||
         (n_col >= G_MAXINT / (cpp + 1)) ||
-        (n_col >= G_MAXINT / sizeof (XPMColor)))
+        (n_col >= G_MAXINT / (gint) sizeof (XPMColor)))
     {
         g_warning ("Pixmap definition contains invalid attributes");
         return NULL;
diff --git a/src/netwm.c b/src/netwm.c
index 276a8a8..d29bf64 100644
--- a/src/netwm.c
+++ b/src/netwm.c
@@ -1302,7 +1302,7 @@ clientWindowType (Client * c)
         if ((c2) && (c->initial_layer < c2->win_layer))
         {
             c->initial_layer = c2->win_layer;
-            TRACE ("Applied layer is %i", c->initial_layer);
+            TRACE ("Applied layer is %lu", c->initial_layer);
         }
         FLAG_UNSET (c->xfwm_flags, XFWM_FLAG_HAS_HIDE);
     }
@@ -1310,7 +1310,7 @@ clientWindowType (Client * c)
     {
         if ((old_type != c->type) || (c->initial_layer != c->win_layer))
         {
-            TRACE ("setting layer %i", c->initial_layer);
+            TRACE ("setting layer %lu", c->initial_layer);
             clientSetLayer (c, c->initial_layer);
             clientSetNetState (c);
         }
@@ -1398,7 +1398,7 @@ void
 clientReceiveNetWMPong (ScreenInfo *screen_info, guint32 timestamp)
 {
     Client *c;
-    int i;
+    guint i;
 
     g_return_if_fail (screen_info != NULL);
     g_return_if_fail (timestamp != CurrentTime);
diff --git a/src/parserc.c b/src/parserc.c
index 5f2eb66..132ecaa 100644
--- a/src/parserc.c
+++ b/src/parserc.c
@@ -155,7 +155,7 @@ setValue (const gchar * lvalue, const gchar *rvalue, Settings *rc)
     return FALSE;
 }
 
-gboolean
+static gboolean
 setGValue (const gchar * lvalue, const GValue *rvalue, Settings *rc)
 {
     gint i;
diff --git a/src/placement.c b/src/placement.c
index dc68dcb..f66f177 100644
--- a/src/placement.c
+++ b/src/placement.c
@@ -99,7 +99,8 @@ void
 clientMaxSpace (ScreenInfo *screen_info, int *x, int *y, int *w, int *h)
 {
     Client *c2;
-    int i, delta, screen_width, screen_height;
+    guint i;
+    gint delta, screen_width, screen_height;
 
     g_return_if_fail (x != NULL);
     g_return_if_fail (y != NULL);
@@ -162,7 +163,8 @@ clientCkeckTitle (Client * c)
 {
     Client *c2;
     ScreenInfo *screen_info;
-    int i, frame_x, frame_y, frame_width, frame_top;
+    guint i;
+    gint frame_x, frame_y, frame_width, frame_top;
 
     frame_x = frameX (c);
     frame_y = frameY (c);
@@ -196,11 +198,12 @@ clientConstrainPos (Client * c, gboolean show_full)
 {
     Client *c2;
     ScreenInfo *screen_info;
-    int i, cx, cy, disp_x, disp_y, disp_max_x, disp_max_y;
-    int frame_height, frame_width, frame_top, frame_left;
-    int frame_x, frame_y, frame_visible;
-    int screen_width, screen_height;
-    unsigned int ret;
+    guint i;
+    gint cx, cy, disp_x, disp_y, disp_max_x, disp_max_y;
+    gint frame_height, frame_width, frame_top, frame_left;
+    gint frame_x, frame_y, frame_visible;
+    gint screen_width, screen_height;
+    guint ret;
     GdkRectangle rect;
     gint min_visible;
 
@@ -538,8 +541,9 @@ smartPlacement (Client * c, int full_x, int full_y, int full_w, int full_h)
     Client *c2;
     ScreenInfo *screen_info;
     gfloat best_overlaps;
-    int test_x, test_y, xmax, ymax, best_x, best_y, i;
-    int frame_x, frame_y, frame_height, frame_width, frame_left, frame_top;
+    guint i;
+    gint test_x, test_y, xmax, ymax, best_x, best_y;
+    gint frame_x, frame_y, frame_height, frame_width, frame_left, frame_top;
     gboolean first;
 
     g_return_if_fail (c != NULL);
@@ -756,8 +760,9 @@ clientFill (Client * c, int fill_type)
     GdkRectangle rect;
     XWindowChanges wc;
     unsigned short mask;
-    int i, cx, cy, full_x, full_y, full_w, full_h;
-    int tmp_x, tmp_y, tmp_w, tmp_h;
+    guint i;
+    gint cx, cy, full_x, full_y, full_w, full_h;
+    gint tmp_x, tmp_y, tmp_w, tmp_h;
 
     g_return_if_fail (c != NULL);
     TRACE ("entering clientFill");
diff --git a/src/screen.c b/src/screen.c
index 4cc97de..3aacc12 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -391,7 +391,7 @@ myScreenGetGdkWindow (ScreenInfo *screen_info)
 }
 
 gboolean
-myScreenGrabKeyboard (ScreenInfo *screen_info, guint32 time)
+myScreenGrabKeyboard (ScreenInfo *screen_info, guint32 timestamp)
 {
     gboolean grab;
 
@@ -406,7 +406,7 @@ myScreenGrabKeyboard (ScreenInfo *screen_info, guint32 time)
                                screen_info->xfwm4_win,
                                FALSE,
                                GrabModeAsync, GrabModeAsync,
-                               (Time) time) == GrabSuccess);
+                               (Time) timestamp) == GrabSuccess);
     }
     screen_info->key_grabs++;
     TRACE ("global key grabs %i", screen_info->key_grabs);
@@ -415,7 +415,7 @@ myScreenGrabKeyboard (ScreenInfo *screen_info, guint32 time)
 }
 
 gboolean
-myScreenGrabPointer (ScreenInfo *screen_info, unsigned int event_mask, Cursor cursor, guint32 time)
+myScreenGrabPointer (ScreenInfo *screen_info, unsigned int event_mask, Cursor cursor, guint32 timestamp)
 {
     gboolean grab;
 
@@ -431,7 +431,7 @@ myScreenGrabPointer (ScreenInfo *screen_info, unsigned int event_mask, Cursor cu
                               GrabModeAsync, GrabModeAsync,
                               screen_info->xroot,
                               cursor,
-                              (Time) time) == GrabSuccess);
+                              (Time) timestamp) == GrabSuccess);
     }
     screen_info->pointer_grabs++;
     TRACE ("global pointer grabs %i", screen_info->pointer_grabs);
@@ -440,7 +440,7 @@ myScreenGrabPointer (ScreenInfo *screen_info, unsigned int event_mask, Cursor cu
 }
 
 gboolean
-myScreenChangeGrabPointer (ScreenInfo *screen_info, unsigned int event_mask, Cursor cursor, guint32 time)
+myScreenChangeGrabPointer (ScreenInfo *screen_info, unsigned int event_mask, Cursor cursor, guint32 timestamp)
 {
     gboolean grab;
 
@@ -451,14 +451,14 @@ myScreenChangeGrabPointer (ScreenInfo *screen_info, unsigned int event_mask, Cur
     if (screen_info->pointer_grabs > 0)
     {
         grab = (XChangeActivePointerGrab (myScreenGetXDisplay (screen_info),
-                                          event_mask, cursor, (Time) time) == GrabSuccess);
+                                          event_mask, cursor, (Time) timestamp) == GrabSuccess);
     }
 
     return grab;
 }
 
 unsigned int
-myScreenUngrabKeyboard (ScreenInfo *screen_info, guint32 time)
+myScreenUngrabKeyboard (ScreenInfo *screen_info, guint32 timestamp)
 {
     g_return_val_if_fail (screen_info, 0);
     TRACE ("entering myScreenUngrabKeyboard");
@@ -470,7 +470,7 @@ myScreenUngrabKeyboard (ScreenInfo *screen_info, guint32 time)
     }
     if (screen_info->key_grabs == 0)
     {
-        XUngrabKeyboard (myScreenGetXDisplay (screen_info), (Time) time);
+        XUngrabKeyboard (myScreenGetXDisplay (screen_info), (Time) timestamp);
     }
     TRACE ("global key grabs %i", screen_info->key_grabs);
 
@@ -478,7 +478,7 @@ myScreenUngrabKeyboard (ScreenInfo *screen_info, guint32 time)
 }
 
 unsigned int
-myScreenUngrabPointer (ScreenInfo *screen_info, guint32 time)
+myScreenUngrabPointer (ScreenInfo *screen_info, guint32 timestamp)
 {
     g_return_val_if_fail (screen_info, 0);
     TRACE ("entering myScreenUngrabPointer");
@@ -490,7 +490,7 @@ myScreenUngrabPointer (ScreenInfo *screen_info, guint32 time)
     }
     if (screen_info->pointer_grabs == 0)
     {
-        XUngrabPointer (myScreenGetXDisplay (screen_info), (Time) time);
+        XUngrabPointer (myScreenGetXDisplay (screen_info), (Time) timestamp);
     }
     TRACE ("global pointer grabs %i", screen_info->pointer_grabs);
 
@@ -548,7 +548,7 @@ Client *
 myScreenGetClientFromWindow (ScreenInfo *screen_info, Window w, unsigned short mode)
 {
     Client *c;
-    int i;
+    guint i;
 
     g_return_val_if_fail (w != None, NULL);
     TRACE ("entering myScreenGetClientFromWindow");
diff --git a/src/screen.h b/src/screen.h
index 1a2086f..282060e 100644
--- a/src/screen.h
+++ b/src/screen.h
@@ -93,15 +93,15 @@ struct _ScreenInfo
     GdkGC *white_gc;
 
     /* Title font height */
-    int font_height;
+    gint font_height;
 
     /* Screen data */
     Colormap cmap;
     GdkScreen *gscr;
     Screen *xscreen;
-    int depth;
-    int width;
-    int height;
+    gint depth;
+    gint width;
+    gint height;
     Visual *visual;
 
     GtkWidget *gtk_win;
@@ -109,17 +109,17 @@ struct _ScreenInfo
     Window xfwm4_win;
     Window xroot;
 
-    int gnome_margins[4];
-    int margins[4];
-    int screen;
-    int current_ws;
-    int previous_ws;
+    gint gnome_margins[4];
+    gint margins[4];
+    gint screen;
+    guint current_ws;
+    guint previous_ws;
 
     /* Monitor search caching */
     GdkRectangle cache_monitor;
 
     /* Workspace definitions */
-    int workspace_count;
+    guint workspace_count;
     gchar **workspace_names;
     int workspace_names_items;
     NetWmDesktopLayout desktop_layout;
@@ -190,7 +190,6 @@ ScreenInfo              *myScreenInit                           (DisplayInfo *,
 ScreenInfo              *myScreenClose                          (ScreenInfo *);
 Display                 *myScreenGetXDisplay                    (ScreenInfo *);
 GtkWidget               *myScreenGetGtkWidget                   (ScreenInfo *);
-GtkWidget               *myScreenGetGtkWidget                   (ScreenInfo *);
 GdkWindow               *myScreenGetGdkWindow                   (ScreenInfo *);
 gboolean                 myScreenGrabKeyboard                   (ScreenInfo *,
                                                                  guint32);
diff --git a/src/session.c b/src/session.c
index c59984e..22a7922 100644
--- a/src/session.c
+++ b/src/session.c
@@ -268,10 +268,10 @@ sessionSaveScreen (ScreenInfo *screen_info, FILE *f)
 {
     DisplayInfo *display_info;
     Client *c;
-    char *client_id, *window_role;
-    char **wm_command;
-    int wm_command_count;
-    gint client_idx;
+    gchar *client_id, *window_role;
+    gchar **wm_command;
+    gint wm_command_count;
+    guint client_idx;
 
     display_info = screen_info->display_info;
     wm_command_count = 0;
@@ -391,8 +391,8 @@ gboolean
 sessionLoadWindowStates (gchar * filename)
 {
     FILE *f;
-    char s[4096], s1[4096];
-    int i, pos, pos1;
+    gchar s[4096], s1[4096];
+    gint i, pos, pos1;
     unsigned long w;
 
     g_return_val_if_fail (filename != NULL, FALSE);
@@ -506,7 +506,7 @@ sessionLoadWindowStates (gchar * filename)
 void
 sessionFreeWindowStates (void)
 {
-    int i;
+    gint i;
 
     for (i = 0; i < num_match; i++)
     {
@@ -561,11 +561,11 @@ matchWin (Client * c, Match * m)
 {
     ScreenInfo *screen_info;
     DisplayInfo *display_info;
-    char *client_id;
-    char *window_role;
-    char **wm_command;
-    int wm_command_count;
-    int i;
+    gchar *client_id;
+    gchar *window_role;
+    gchar **wm_command;
+    gint wm_command_count;
+    gint i;
     gboolean found;
 
     g_return_val_if_fail (c != NULL, FALSE);
@@ -677,7 +677,7 @@ matchWin (Client * c, Match * m)
 gboolean
 sessionMatchWinToSM (Client * c)
 {
-    int i;
+    gint i;
 
     g_return_val_if_fail (c != NULL, FALSE);
     for (i = 0; i < num_match; i++)
diff --git a/src/settings.c b/src/settings.c
index a1129ae..e75d227 100644
--- a/src/settings.c
+++ b/src/settings.c
@@ -862,10 +862,10 @@ loadSettings (ScreenInfo *screen_info)
         screen_info->params->double_click_action = DBL_CLICK_ACTION_NONE;
     }
 
-    if (screen_info->workspace_count < 0)
+    if (screen_info->workspace_count == 0)
     {
-        gint workspace_count;
-        workspace_count = MAX (getIntValue ("workspace_count", rc), 0);
+        guint workspace_count;
+        workspace_count = MAX ((guint) getIntValue ("workspace_count", rc), 0);
         workspaceSetCount (screen_info, workspace_count);
     }
 
@@ -987,7 +987,7 @@ initSettings (ScreenInfo *screen_info)
     DisplayInfo *display_info;
     char **names;
     long val;
-    int i;
+    guint i;
 
     g_return_val_if_fail (screen_info, FALSE);
 
@@ -1425,20 +1425,20 @@ cb_shortcut_removed (XfceShortcutsProvider *provider, const gchar *shortcut,
 }
 
 static void
-parseShortcut (ScreenInfo *screen_info, int index, const gchar *name,
+parseShortcut (ScreenInfo *screen_info, int id, const gchar *name,
                GList *shortcuts)
 {
     Display *dpy;
     const gchar *shortcut;
 
     g_return_if_fail (screen_info);
-    g_return_if_fail (index >= 0 && index < KEY_COUNT);
+    g_return_if_fail (id >= 0 && id < KEY_COUNT);
 
     dpy = myScreenGetXDisplay (screen_info);
     shortcut = getShortcut (name, shortcuts);
-    parseKeyString (dpy, &screen_info->params->keys[index], shortcut);
+    parseKeyString (dpy, &screen_info->params->keys[id], shortcut);
 
-    screen_info->params->keys[index].internal_name = g_strdup (name);
+    screen_info->params->keys[id].internal_name = g_strdup (name);
 }
 
 static const gchar *
diff --git a/src/settings.h b/src/settings.h
index db1995e..a73383b 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -165,12 +165,12 @@ struct _XfwmParams
 {
     MyKey keys[KEY_COUNT];
     gchar button_layout[BUTTON_STRING_COUNT + 1];
-    unsigned int xfwm_margins[4];
+    int xfwm_margins[4];
     int activate_action;
     int button_offset;
     int button_spacing;
     int double_click_action;
-    int easy_click;
+    guint easy_click;
     int focus_delay;
     int frame_opacity;
     int inactive_opacity;
diff --git a/src/stacking.c b/src/stacking.c
index 3b3bcc3..e49bcb2 100644
--- a/src/stacking.c
+++ b/src/stacking.c
@@ -61,12 +61,12 @@ clientApplyStackList (ScreenInfo *screen_info)
 
     if (nwindows)
     {
-        GList *index;
+        GList *list;
         Client *c = NULL;
 
-        for (index = g_list_last(screen_info->windows_stack); index; index = g_list_previous (index))
+        for (list = g_list_last(screen_info->windows_stack); list; list = g_list_previous (list))
         {
-            c = (Client *) index->data;
+            c = (Client *) list->data;
             xwinstack[i++] = c->frame;
             DBG ("  [%i] \"%s\" (0x%lx)", i, c->name, c->window);
         }
@@ -82,7 +82,7 @@ clientGetLowestTransient (Client * c)
 {
     ScreenInfo *screen_info;
     Client *lowest_transient, *c2;
-    GList *index;
+    GList *list;
 
     g_return_val_if_fail (c != NULL, NULL);
 
@@ -90,9 +90,9 @@ clientGetLowestTransient (Client * c)
 
     lowest_transient = NULL;
     screen_info = c->screen_info;
-    for (index = screen_info->windows_stack; index; index = g_list_next (index))
+    for (list = screen_info->windows_stack; list; list = g_list_next (list))
     {
-        c2 = (Client *) index->data;
+        c2 = (Client *) list->data;
         if ((c2 != c) && clientIsTransientFor (c2, c))
         {
             lowest_transient = c2;
@@ -108,16 +108,16 @@ clientGetHighestTransientOrModalFor (Client * c)
     ScreenInfo *screen_info;
     Client *highest_transient;
     Client *c2;
-    GList *index;
+    GList *list;
 
     g_return_val_if_fail (c != NULL, NULL);
     TRACE ("entering clientGetHighestTransientOrModalFor");
 
     screen_info = c->screen_info;
     highest_transient = NULL;
-    for (index = screen_info->windows_stack; index; index = g_list_next (index))
+    for (list = screen_info->windows_stack; list; list = g_list_next (list))
     {
-        c2 = (Client *) index->data;
+        c2 = (Client *) list->data;
         if (c2)
         {
             if (clientIsTransientOrModalFor (c, c2))
@@ -136,16 +136,16 @@ clientGetTopMostForGroup (Client * c)
     ScreenInfo *screen_info;
     Client *top_most;
     Client *c2;
-    GList *index;
+    GList *list;
 
     g_return_val_if_fail (c != NULL, NULL);
     TRACE ("entering clientGetTopMostForGroup");
 
     screen_info = c->screen_info;
     top_most = NULL;
-    for (index = screen_info->windows_stack; index; index = g_list_next (index))
+    for (list = screen_info->windows_stack; list; list = g_list_next (list))
     {
-        c2 = (Client *) index->data;
+        c2 = (Client *) list->data;
         if (c2 != c)
         {
             if (clientSameGroup (c, c2))
@@ -162,7 +162,7 @@ gboolean
 clientIsTopMost (Client *c)
 {
     ScreenInfo *screen_info;
-    GList *index, *index2;
+    GList *list, *list2;
     Client *c2;
 
     g_return_val_if_fail (c != NULL, FALSE);
@@ -170,35 +170,35 @@ clientIsTopMost (Client *c)
 
     screen_info = c->screen_info;
 
-    index = g_list_find (screen_info->windows_stack, (gconstpointer) c);
-    if (index)
+    list = g_list_find (screen_info->windows_stack, (gconstpointer) c);
+    if (list)
     {
-        index2 = g_list_next (index);
-        while (index2)
+        list2 = g_list_next (list);
+        while (list2)
         {
-            c2 = (Client *) index2->data;
+            c2 = (Client *) list2->data;
             if (FLAG_TEST (c2->xfwm_flags, XFWM_FLAG_VISIBLE) && (c2->win_layer == c->win_layer))
             {
                 return FALSE;
             }
-            index2 = g_list_next (index2);
+            list2 = g_list_next (list2);
         }
     }
     return TRUE;
 }
 
 Client *
-clientGetNextTopMost (ScreenInfo *screen_info, int layer, Client * exclude)
+clientGetNextTopMost (ScreenInfo *screen_info, guint layer, Client * exclude)
 {
     Client *top, *c;
-    GList *index;
+    GList *list;
 
     TRACE ("entering clientGetNextTopMost");
 
     top = NULL;
-    for (index = screen_info->windows_stack; index; index = g_list_next (index))
+    for (list = screen_info->windows_stack; list; list = g_list_next (list))
     {
-        c = (Client *) index->data;
+        c = (Client *) list->data;
         TRACE ("*** stack window \"%s\" (0x%lx), layer %i", c->name, c->window, (int) c->win_layer);
         if (!exclude || (c != exclude))
         {
@@ -214,17 +214,17 @@ clientGetNextTopMost (ScreenInfo *screen_info, int layer, Client * exclude)
 }
 
 Client *
-clientGetBottomMost (ScreenInfo *screen_info, int layer, Client * exclude)
+clientGetBottomMost (ScreenInfo *screen_info, guint layer, Client * exclude)
 {
     Client *bot, *c;
-    GList *index;
+    GList *list;
 
     TRACE ("entering clientGetBottomMost");
 
     bot = NULL;
-    for (index = screen_info->windows_stack; index; index = g_list_next (index))
+    for (list = screen_info->windows_stack; list; list = g_list_next (list))
     {
-        c = (Client *) index->data;
+        c = (Client *) list->data;
         if (c)
         {
             TRACE ("*** stack window \"%s\" (0x%lx), layer %i", c->name,
@@ -252,15 +252,15 @@ clientGetBottomMost (ScreenInfo *screen_info, int layer, Client * exclude)
 Client *
 clientAtPosition (ScreenInfo *screen_info, int x, int y, GList * exclude_list)
 {
-    GList *index;
+    GList *list;
     Client *c, *c2;
 
     TRACE ("entering clientAtPosition");
 
     c = NULL;
-    for (index = g_list_last (screen_info->windows_stack); index; index = g_list_previous (index))
+    for (list = g_list_last (screen_info->windows_stack); list; list = g_list_previous (list))
     {
-        c2 = (Client *) index->data;
+        c2 = (Client *) list->data;
         if ((frameX (c2) <= x) && (frameX (c2) + frameWidth (c2) >= x)
             && (frameY (c2) <= y) && (frameY (c2) + frameHeight (c2) >= y))
         {
@@ -284,7 +284,7 @@ clientRaise (Client * c, Window wsibling)
     Client *c2, *c3, *client_sibling;
     GList *transients;
     GList *sibling;
-    GList *index1, *index2;
+    GList *list1, *list2;
     GList *windows_stack_copy;
 
     g_return_if_fail (c != NULL);
@@ -342,10 +342,10 @@ clientRaise (Client * c, Window wsibling)
                 sibling = g_list_find (screen_info->windows_stack, (gconstpointer) c2);
                 if (sibling)
                 {
-                    index1 = g_list_next (sibling);
-                    if (index1)
+                    list1 = g_list_next (sibling);
+                    if (list1)
                     {
-                        client_sibling = (Client *) index1->data;
+                        client_sibling = (Client *) list1->data;
                         /* Do not place window under higher layers though */
                         if ((client_sibling) && (client_sibling->win_layer < c->win_layer))
                         {
@@ -373,9 +373,9 @@ clientRaise (Client * c, Window wsibling)
             screen_info->windows_stack = g_list_append (screen_info->windows_stack, c);
         }
         /* Now, look for transients, transients of transients, etc. */
-        for (index1 = windows_stack_copy; index1; index1 = g_list_next (index1))
+        for (list1 = windows_stack_copy; list1; list1 = g_list_next (list1))
         {
-            c2 = (Client *) index1->data;
+            c2 = (Client *) list1->data;
             if (c2)
             {
                 if ((c2 != c) && clientIsTransientOrModalFor (c2, c) && (c2->win_layer <= c->win_layer))
@@ -400,9 +400,9 @@ clientRaise (Client * c, Window wsibling)
                 }
                 else
                 {
-                    for (index2 = transients; index2; index2 = g_list_next (index2))
+                    for (list2 = transients; list2; list2 = g_list_next (list2))
                     {
-                        c3 = (Client *) index2->data;
+                        c3 = (Client *) list2->data;
                         if ((c3 != c2) && clientIsTransientOrModalFor (c2, c3))
                         {
                             transients = g_list_append (transients, c2);
@@ -452,7 +452,7 @@ clientLower (Client * c, Window wsibling)
     DisplayInfo *display_info;
     Client *c2, *client_sibling;
     GList *sibling;
-    GList *index;
+    GList *list;
     gint position;
 
     g_return_if_fail (c != NULL);
@@ -489,10 +489,10 @@ clientLower (Client * c, Window wsibling)
                 sibling = g_list_find (screen_info->windows_stack, (gconstpointer) c2);
                 if (sibling)
                 {
-                    index = g_list_previous (sibling);
-                    if (index)
+                    list = g_list_previous (sibling);
+                    if (list)
                     {
-                        client_sibling = (Client *) index->data;
+                        client_sibling = (Client *) list->data;
                         /* Do not place window above lower layers though */
                         if ((client_sibling) && (client_sibling->win_layer > c->win_layer))
                         {
diff --git a/src/stacking.h b/src/stacking.h
index c65b92d..b7eccc4 100644
--- a/src/stacking.h
+++ b/src/stacking.h
@@ -37,10 +37,10 @@ Client                  *clientGetHighestTransientOrModalFor    (Client *);
 gboolean                 clientIsTopMost                        (Client *);
 Client                  *clientGetTopMostForGroup               (Client *);
 Client                  *clientGetNextTopMost                   (ScreenInfo *,
-                                                                 int,
+                                                                 guint,
                                                                  Client *);
 Client                  *clientGetBottomMost                    (ScreenInfo *,
-                                                                 int,
+                                                                 guint,
                                                                  Client *);
 Client                  *clientAtPosition                       (ScreenInfo *,
                                                                  int,
diff --git a/src/startup_notification.c b/src/startup_notification.c
index d70956b..c91292a 100644
--- a/src/startup_notification.c
+++ b/src/startup_notification.c
@@ -43,6 +43,7 @@
 #include "display.h"
 #include "screen.h"
 #include "client.h"
+#include "startup_notification.h"
 
 #define STARTUP_TIMEOUT (30 /* seconds */ * 1000)
 
@@ -58,13 +59,13 @@ CollectTimedOutData;
 static gboolean sn_startup_sequence_timeout (void *data);
 
 static void
-sn_error_trap_push (SnDisplay * sn_display, Display * dpy)
+sn_error_trap_push (SnDisplay * d, Display * dpy)
 {
     gdk_error_trap_push ();
 }
 
 static void
-sn_error_trap_pop (SnDisplay * sn_display, Display * dpy)
+sn_error_trap_pop (SnDisplay * d, Display * dpy)
 {
     gdk_error_trap_pop ();
 }
diff --git a/src/tabwin.c b/src/tabwin.c
index eac619f..0ba290c 100644
--- a/src/tabwin.c
+++ b/src/tabwin.c
@@ -215,7 +215,7 @@ static GtkWidget *
 createWindowlist (ScreenInfo *screen_info, TabwinWidget *tbw)
 {
     Client *c;
-    GList *clients;
+    GList *client_list;
     GdkRectangle monitor;
     GtkWidget *windowlist, *icon, *selected;
     int i, packpos;
@@ -238,9 +238,9 @@ createWindowlist (ScreenInfo *screen_info, TabwinWidget *tbw)
     windowlist = gtk_table_new (tbw->grid_rows, tbw->grid_cols, FALSE);
 
     /* pack the client icons */
-    for (clients = *t->clients; clients; clients = g_list_next (clients))
+    for (client_list = *t->client_list; client_list; client_list = g_list_next (client_list))
     {
-        c = (Client *) clients->data;
+        c = (Client *) client_list->data;
         TRACE ("createWindowlist: adding %s", c->name);
         icon = createWindowIcon (c);
         gtk_table_attach (GTK_TABLE (windowlist), GTK_WIDGET (icon),
@@ -383,7 +383,7 @@ tabwinCreateWidget (Tabwin *tabwin, ScreenInfo *screen_info, gint monitor_num)
 }
 
 Tabwin *
-tabwinCreate (GList **clients, GList *selected, gboolean display_workspace)
+tabwinCreate (GList **client_list, GList *selected, gboolean display_workspace)
 {
     ScreenInfo *screen_info;
     Client *c;
@@ -391,22 +391,21 @@ tabwinCreate (GList **clients, GList *selected, gboolean display_workspace)
     int num_monitors, i;
 
     g_return_val_if_fail (selected, NULL);
-    g_return_val_if_fail (clients, NULL);
-    g_return_val_if_fail (*clients, NULL);
+    g_return_val_if_fail (client_list, NULL);
+    g_return_val_if_fail (*client_list, NULL);
 
     TRACE ("entering tabwinCreate");
     c = (Client *) selected->data;
     tabwin = g_new0 (Tabwin, 1);
     screen_info = c->screen_info;
     tabwin->display_workspace = display_workspace;
-    tabwin->clients = clients;
+    tabwin->client_list = client_list;
     tabwin->selected = selected;
-    tabwin->client_count = g_list_length (*clients);
-    tabwin->tabwins = NULL;
+    tabwin->tabwin_list = NULL;
     num_monitors = gdk_screen_get_n_monitors (screen_info->gscr);
     for (i = 0; i < num_monitors; i++)
     {
-        tabwin->tabwins  = g_list_append (tabwin->tabwins, tabwinCreateWidget (tabwin, screen_info, i));
+        tabwin->tabwin_list  = g_list_append (tabwin->tabwin_list, tabwinCreateWidget (tabwin, screen_info, i));
     }
 
     return tabwin;
@@ -429,7 +428,7 @@ tabwinGetSelected (Tabwin *t)
 Client *
 tabwinRemoveClient (Tabwin *t, Client *c)
 {
-    GList *clients, *tabwins, *widgets;
+    GList *client_list, *tabwin_list, *widgets;
     GtkWidget *icon;
     TabwinWidget *tbw;
 
@@ -437,29 +436,29 @@ tabwinRemoveClient (Tabwin *t, Client *c)
     g_return_val_if_fail (c != NULL, NULL);
     TRACE ("entering tabwinRemoveClient");
 
-    if (!*t->clients)
+    if (!*t->client_list)
     {
         return NULL;
     }
 
     /* First, remove the client from our own client list */
-    for (clients = *t->clients; clients; clients = g_list_next (clients))
+    for (client_list = *t->client_list; client_list; client_list = g_list_next (client_list))
     {
-        if (clients->data == c)
+        if (client_list->data == c)
         {
-            if (clients == t->selected)
+            if (client_list == t->selected)
             {
                 tabwinSelectNext (t);
             }
-            *t->clients = g_list_delete_link (*t->clients, clients);
+            *t->client_list = g_list_delete_link (*t->client_list, client_list);
             break;
         }
     }
 
     /* Second, remove the icon from all boxes */
-    for (tabwins = t->tabwins; tabwins; tabwins = g_list_next (tabwins))
+    for (tabwin_list = t->tabwin_list; tabwin_list; tabwin_list = g_list_next (tabwin_list))
     {
-        tbw = (TabwinWidget *) tabwins->data;
+        tbw = (TabwinWidget *) tabwin_list->data;
         for (widgets = tbw->widgets; widgets; widgets = g_list_next (widgets))
         {
             icon = GTK_WIDGET (widgets->data);
@@ -475,10 +474,44 @@ tabwinRemoveClient (Tabwin *t, Client *c)
 }
 
 Client *
+tabwinSelectHead (Tabwin *t)
+{
+    GList *head;
+    GList *tabwin_list, *widgets;
+    GtkWidget *icon;
+    TabwinWidget *tbw;
+
+    g_return_val_if_fail (t != NULL, NULL);
+    TRACE ("entering tabwinSelectFirst");
+
+    head = *t->client_list;
+    if (!head)
+    {
+        return NULL;
+    }
+    t->selected = head;
+    for (tabwin_list = t->tabwin_list; tabwin_list; tabwin_list = g_list_next (tabwin_list))
+    {
+        tbw = (TabwinWidget *) tabwin_list->data;
+        for (widgets = tbw->widgets; widgets; widgets = g_list_next (widgets))
+        {
+            icon = GTK_WIDGET (widgets->data);
+            if (((Client *) g_object_get_data (G_OBJECT(icon), "client-ptr-val")) == head->data)
+                {
+                    tabwinSetSelected (tbw, icon);
+                    gtk_widget_queue_draw (tbw->window);
+                }
+            }
+    }
+
+    return tabwinGetSelected (t);
+}
+
+Client *
 tabwinSelectNext (Tabwin *t)
 {
     GList *next;
-    GList *tabwins, *widgets;
+    GList *tabwin_list, *widgets;
     GtkWidget *icon;
     TabwinWidget *tbw;
 
@@ -488,13 +521,13 @@ tabwinSelectNext (Tabwin *t)
     next = g_list_next(t->selected);
     if (!next)
     {
-        next = *t->clients;
+        next = *t->client_list;
         g_return_val_if_fail (next != NULL, NULL);
     }
     t->selected = next;
-    for (tabwins = t->tabwins; tabwins; tabwins = g_list_next (tabwins))
+    for (tabwin_list = t->tabwin_list; tabwin_list; tabwin_list = g_list_next (tabwin_list))
     {
-        tbw = (TabwinWidget *) tabwins->data;
+        tbw = (TabwinWidget *) tabwin_list->data;
         for (widgets = tbw->widgets; widgets; widgets = g_list_next (widgets))
         {
             icon = GTK_WIDGET (widgets->data);
@@ -513,7 +546,7 @@ Client *
 tabwinSelectPrev (Tabwin *t)
 {
     GList *prev;
-    GList *tabwins, *widgets;
+    GList *tabwin_list, *widgets;
     GtkWidget *icon;
     TabwinWidget *tbw;
 
@@ -523,13 +556,13 @@ tabwinSelectPrev (Tabwin *t)
     prev = g_list_previous (t->selected);
     if (!prev)
     {
-        prev = g_list_last (*t->clients);
+        prev = g_list_last (*t->client_list);
         g_return_val_if_fail (prev != NULL, NULL);
     }
     t->selected = prev;
-    for (tabwins = t->tabwins; tabwins; tabwins = g_list_next (tabwins))
+    for (tabwin_list = t->tabwin_list; tabwin_list; tabwin_list = g_list_next (tabwin_list))
     {
-        tbw = (TabwinWidget *) tabwins->data;
+        tbw = (TabwinWidget *) tabwin_list->data;
         for (widgets = tbw->widgets; widgets; widgets = g_list_next (widgets))
         {
             icon = GTK_WIDGET (widgets->data);
@@ -544,39 +577,22 @@ tabwinSelectPrev (Tabwin *t)
     return tabwinGetSelected (t);
 }
 
-Client *
-tabwinGetHead (Tabwin *t)
-{
-    GList *head;
-
-    g_return_val_if_fail (t != NULL, NULL);
-    TRACE ("entering tabwinGetHead");
-
-    head = *t->clients;
-    if (head)
-    {
-        return (Client *)  head->data;
-    }
-
-    return NULL;
-}
-
 void
 tabwinDestroy (Tabwin *t)
 {
-    GList *tabwins;
+    GList *tabwin_list;
     TabwinWidget *tbw;
 
     g_return_if_fail (t != NULL);
     TRACE ("entering tabwinDestroy");
 
     g_return_if_fail (t != NULL);
-    for (tabwins = t->tabwins; tabwins; tabwins = g_list_next (tabwins))
+    for (tabwin_list = t->tabwin_list; tabwin_list; tabwin_list = g_list_next (tabwin_list))
     {
-        tbw = (TabwinWidget *) tabwins->data;
+        tbw = (TabwinWidget *) tabwin_list->data;
         g_list_free (tbw->widgets);
         gtk_widget_destroy (tbw->window);
         g_free (tbw);
     }
-    g_list_free (t->tabwins);
+    g_list_free (t->tabwin_list);
 }
diff --git a/src/tabwin.h b/src/tabwin.h
index 32d70eb..202ceb7 100644
--- a/src/tabwin.h
+++ b/src/tabwin.h
@@ -36,10 +36,9 @@ typedef struct _TabwinWidget TabwinWidget;
 
 struct _Tabwin
 {
-    GList *tabwins;
-    GList **clients;
+    GList *tabwin_list;
+    GList **client_list;
     GList *selected;
-    guint client_count;
     gboolean display_workspace;
 };
 
@@ -67,9 +66,9 @@ Tabwin                  *tabwinCreate                           (GList **,
                                                                  GList *,
                                                                  gboolean);
 Client                  *tabwinGetSelected                      (Tabwin *);
+Client                  *tabwinSelectHead                       (Tabwin *);
 Client                  *tabwinSelectNext                       (Tabwin *);
 Client                  *tabwinSelectPrev                       (Tabwin *);
-Client                  *tabwinGetHead                          (Tabwin *);
 Client                  *tabwinRemoveClient                     (Tabwin *,
                                                                  Client *);
 void                    tabwinDestroy                           (Tabwin *);
diff --git a/src/terminate.c b/src/terminate.c
index 895ef7d..e4f59df 100644
--- a/src/terminate.c
+++ b/src/terminate.c
@@ -30,6 +30,7 @@
 #include <errno.h>
 
 #include "client.h"
+#include "terminate.h"
 
 void
 terminateCloseDialog (Client *c)
diff --git a/src/transients.c b/src/transients.c
index 9b46946..a3bd027 100644
--- a/src/transients.c
+++ b/src/transients.c
@@ -211,12 +211,12 @@ clientIsValidTransientOrModal (Client * c)
     if (clientIsTransientOrModalForGroup (c))
     {
         ScreenInfo *screen_info = c->screen_info;
-        GList *index;
+        GList *list;
 
         /* Look for a valid transient or modal for the same group */
-        for (index = screen_info->windows_stack; index; index = g_list_next (index))
+        for (list = screen_info->windows_stack; list; list = g_list_next (list))
         {
-            Client *c2 = (Client *) index->data;
+            Client *c2 = (Client *) list->data;
             if (c2 != c)
             {
                 if (clientIsTransientOrModalFor (c, c2))
@@ -236,10 +236,10 @@ clientIsValidTransientOrModal (Client * c)
 }
 
 gboolean
-clientTransientOrModalHasAncestor (Client * c, int ws)
+clientTransientOrModalHasAncestor (Client * c, guint ws)
 {
     Client *c2;
-    GList *index;
+    GList *list;
     ScreenInfo *screen_info;
 
     g_return_val_if_fail (c != NULL, FALSE);
@@ -252,9 +252,9 @@ clientTransientOrModalHasAncestor (Client * c, int ws)
     }
 
     screen_info = c->screen_info;
-    for (index = screen_info->windows_stack; index; index = g_list_next (index))
+    for (list = screen_info->windows_stack; list; list = g_list_next (list))
     {
-        c2 = (Client *) index->data;
+        c2 = (Client *) list->data;
         if ((c2 != c) && !clientIsTransientOrModal (c2)
             && clientIsTransientOrModalFor (c, c2)
             && !FLAG_TEST (c2->flags, CLIENT_FLAG_ICONIFIED)
@@ -272,15 +272,15 @@ clientGetModalFor (Client * c)
 {
     ScreenInfo *screen_info;
     Client *c2;
-    GList *index;
+    GList *list;
 
     g_return_val_if_fail (c != NULL, NULL);
     TRACE ("entering clientGetModalFor");
 
     screen_info = c->screen_info;
-    for (index = g_list_last(screen_info->windows_stack); index; index = g_list_previous (index))
+    for (list = g_list_last(screen_info->windows_stack); list; list = g_list_previous (list))
     {
-        c2 = (Client *) index->data;
+        c2 = (Client *) list->data;
         if (c2)
         {
             if ((c2 != c) && clientIsModalFor (c2, c))
@@ -298,20 +298,20 @@ clientGetTransientFor (Client * c)
     ScreenInfo *screen_info;
     Client *latest_transient;
     Client *c2;
-    GList *index;
+    GList *list;
 
     g_return_val_if_fail (c != NULL, NULL);
     TRACE ("entering clientGetTransientFor");
 
     latest_transient = c;
     screen_info = c->screen_info;
-    for (index = g_list_last(screen_info->windows_stack); index; index = g_list_previous (index))
+    for (list = g_list_last(screen_info->windows_stack); list; list = g_list_previous (list))
     {
         if (!clientIsTransient (latest_transient))
         {
             break;
         }
-        c2 = (Client *) index->data;
+        c2 = (Client *) list->data;
         if (c2)
         {
             if (clientIsTransientFor (latest_transient, c2))
@@ -331,16 +331,16 @@ clientListTransient (Client * c)
     ScreenInfo *screen_info;
     Client *c2, *c3;
     GList *transients;
-    GList *index1, *index2;
+    GList *list1, *list2;
 
     g_return_val_if_fail (c != NULL, NULL);
 
     transients = NULL;
     screen_info = c->screen_info;
     transients = g_list_append (transients, c);
-    for (index1 = screen_info->windows_stack; index1; index1 = g_list_next (index1))
+    for (list1 = screen_info->windows_stack; list1; list1 = g_list_next (list1))
     {
-        c2 = (Client *) index1->data;
+        c2 = (Client *) list1->data;
         if (c2 != c)
         {
             if (clientIsTransientFor (c2, c))
@@ -349,10 +349,10 @@ clientListTransient (Client * c)
             }
             else
             {
-                for (index2 = transients; index2;
-                    index2 = g_list_next (index2))
+                for (list2 = transients; list2;
+                    list2 = g_list_next (list2))
                 {
-                    c3 = (Client *) index2->data;
+                    c3 = (Client *) list2->data;
                     if ((c3 != c2) && clientIsTransientFor (c2, c3))
                     {
                         transients = g_list_append (transients, c2);
@@ -372,16 +372,16 @@ clientListTransientOrModal (Client * c)
     ScreenInfo *screen_info;
     Client *c2, *c3;
     GList *transients;
-    GList *index1, *index2;
+    GList *list1, *list2;
 
     g_return_val_if_fail (c != NULL, NULL);
 
     screen_info = c->screen_info;
     transients = NULL;
     transients = g_list_append (transients, c);
-    for (index1 = screen_info->windows_stack; index1; index1 = g_list_next (index1))
+    for (list1 = screen_info->windows_stack; list1; list1 = g_list_next (list1))
     {
-        c2 = (Client *) index1->data;
+        c2 = (Client *) list1->data;
         if (c2 != c)
         {
             if (clientIsTransientOrModalFor (c2, c))
@@ -390,10 +390,10 @@ clientListTransientOrModal (Client * c)
             }
             else
             {
-                for (index2 = transients; index2;
-                    index2 = g_list_next (index2))
+                for (list2 = transients; list2;
+                    list2 = g_list_next (list2))
                 {
-                    c3 = (Client *) index2->data;
+                    c3 = (Client *) list2->data;
                     if ((c3 != c2) && clientIsTransientOrModalFor (c2, c3))
                     {
                         transients = g_list_append (transients, c2);
@@ -413,15 +413,15 @@ gboolean
 clientCheckTransientWindow (Client *c, Window w)
 {
     GList *transients;
-    GList *index;
+    GList *list;
     Client *c2;
 
     g_return_val_if_fail (c != NULL, FALSE);
 
     transients = clientListTransient (c);
-    for (index = transients; index; index = g_list_next (index))
+    for (list = transients; list; list = g_list_next (list))
     {
-        c2 = (Client *) index->data;
+        c2 = (Client *) list->data;
         if (c2->window == w)
         {
             g_list_free (transients);
diff --git a/src/transients.h b/src/transients.h
index 0f27025..dc544fd 100644
--- a/src/transients.h
+++ b/src/transients.h
@@ -51,13 +51,11 @@ gboolean                 clientIsTransientForGroup              (Client *);
 gboolean                 clientIsModalForGroup                  (Client *);
 gboolean                 clientIsTransientOrModalForGroup       (Client *);
 gboolean                 clientTransientOrModalHasAncestor      (Client *,
-                                                                 int);
+                                                                 guint);
 Client                  *clientGetModalFor                      (Client *);
 Client                  *clientGetTransientFor                  (Client *);
 GList                   *clientListTransient                    (Client *);
 GList                   *clientListTransientOrModal             (Client *);
 gboolean                 clientCheckTransientWindow             (Client *,
                                                                  Window);
-gboolean                 clientSameApplication                  (Client *,
-                                                                 Client *);
 #endif /* INC_TRANSIENTS_H */
diff --git a/src/workspaces.c b/src/workspaces.c
index 65f4df7..d8fc596 100644
--- a/src/workspaces.c
+++ b/src/workspaces.c
@@ -96,11 +96,12 @@ workspaceGetPosition (ScreenInfo *screen_info, int n, int * row, int * col)
     }
 }
 
-static int
-workspaceGetNumber (ScreenInfo *screen_info, int row, int col)
+static gint
+workspaceGetNumber (ScreenInfo *screen_info, gint row, gint col)
 {
     NetWmDesktopLayout l;
-    int major_length, minor_length, n, tmp;
+    gulong major_length, minor_length;
+    guint n, tmp;
 
     l = screen_info->desktop_layout;
     if (l.orientation == NET_WM_ORIENTATION_HORZ)
@@ -178,9 +179,10 @@ modify_with_wrap (int value, int by, int limit, gboolean wrap)
 
 /* returns TRUE if the workspace was changed, FALSE otherwise */
 gboolean
-workspaceMove (ScreenInfo *screen_info, int rowmod, int colmod, Client * c, guint32 timestamp)
+workspaceMove (ScreenInfo *screen_info, gint rowmod, gint colmod, Client * c, guint32 timestamp)
 {
-    int row, col, newrow, newcol, previous_ws, n;
+    gint row, col, newrow, newcol, n;
+    guint previous_ws;
 
     g_return_val_if_fail (screen_info != NULL, FALSE);
 
@@ -191,13 +193,13 @@ workspaceMove (ScreenInfo *screen_info, int rowmod, int colmod, Client * c, guin
     newcol = modify_with_wrap (col, colmod, screen_info->desktop_layout.cols, screen_info->params->wrap_layout);
     n = workspaceGetNumber (screen_info, newrow, newcol);
 
-    if (n == screen_info->current_ws)
+    if (n == (gint) screen_info->current_ws)
     {
         return FALSE;
     }
 
     previous_ws = screen_info->current_ws;
-    if ((n >= 0) && (n < screen_info->workspace_count))
+    if ((n >= 0) && (n < (gint) screen_info->workspace_count))
     {
         workspaceSwitch (screen_info, n, c, TRUE, timestamp);
     }
@@ -235,15 +237,15 @@ workspaceMove (ScreenInfo *screen_info, int rowmod, int colmod, Client * c, guin
 }
 
 void
-workspaceSwitch (ScreenInfo *screen_info, int new_ws, Client * c2, gboolean update_focus, guint32 timestamp)
+workspaceSwitch (ScreenInfo *screen_info, gint new_ws, Client * c2, gboolean update_focus, guint32 timestamp)
 {
     DisplayInfo *display_info;
     Client *c, *new_focus;
     Client *previous;
-    GList *index;
+    GList *list;
     GList *list_hide;
     Window dr, window;
-    int rx, ry, wx, wy;
+    gint rx, ry, wx, wy;
     unsigned int mask;
     unsigned long data[1];
 
@@ -252,28 +254,28 @@ workspaceSwitch (ScreenInfo *screen_info, int new_ws, Client * c2, gboolean upda
     TRACE ("entering workspaceSwitch");
 
     display_info = screen_info->display_info;
-    if ((new_ws == screen_info->current_ws) && (screen_info->params->toggle_workspaces))
+    if ((new_ws == (gint) screen_info->current_ws) && (screen_info->params->toggle_workspaces))
     {
-        new_ws = screen_info->previous_ws;
+        new_ws = (gint) screen_info->previous_ws;
     }
 
-    if (new_ws == screen_info->current_ws)
+    if (new_ws == (gint) screen_info->current_ws)
     {
         return;
     }
 
     if (screen_info->params->wrap_cycle)
     {
-        if (new_ws > screen_info->workspace_count - 1)
+        if (new_ws > (gint) screen_info->workspace_count - 1)
         {
             new_ws = 0;
         }
         if (new_ws < 0)
         {
-            new_ws = screen_info->workspace_count - 1;
+            new_ws = (gint) screen_info->workspace_count - 1;
         }
     }
-    else if ((new_ws > screen_info->workspace_count - 1) || (new_ws < 0))
+    else if ((new_ws > (gint) screen_info->workspace_count - 1) || (new_ws < 0))
     {
         return;
     }
@@ -304,14 +306,14 @@ workspaceSwitch (ScreenInfo *screen_info, int new_ws, Client * c2, gboolean upda
     }
 
     /* First pass: Show, from top to bottom */
-    for (index = g_list_last(screen_info->windows_stack); index; index = g_list_previous (index))
+    for (list = g_list_last(screen_info->windows_stack); list; list = g_list_previous (list))
     {
-        c = (Client *) index->data;
+        c = (Client *) list->data;
         if (FLAG_TEST (c->flags, CLIENT_FLAG_STICKY))
         {
             clientSetWorkspace (c, new_ws, TRUE);
         }
-        else if (c->win_workspace == new_ws)
+        else if (new_ws == (gint) c->win_workspace)
         {
             if (!FLAG_TEST (c->flags, CLIENT_FLAG_ICONIFIED) && !FLAG_TEST (c->xfwm_flags, XFWM_FLAG_VISIBLE))
             {
@@ -324,11 +326,11 @@ workspaceSwitch (ScreenInfo *screen_info, int new_ws, Client * c2, gboolean upda
     }
 
     /* Second pass: Hide from bottom to top */
-    for (index = screen_info->windows_stack; index; index = g_list_next (index))
+    for (list = screen_info->windows_stack; list; list = g_list_next (list))
     {
-        c = (Client *) index->data;
+        c = (Client *) list->data;
 
-        if (c->win_workspace != new_ws)
+        if (new_ws != (gint) c->win_workspace)
         {
             if (c == previous)
             {
@@ -346,9 +348,9 @@ workspaceSwitch (ScreenInfo *screen_info, int new_ws, Client * c2, gboolean upda
     }
 
     /* Third pass: Check for focus, from top to bottom */
-    for (index = g_list_last(screen_info->windows_stack); index; index = g_list_previous (index))
+    for (list = g_list_last(screen_info->windows_stack); list; list = g_list_previous (list))
     {
-        c = (Client *) index->data;
+        c = (Client *) list->data;
 
         if (FLAG_TEST (c->flags, CLIENT_FLAG_STICKY))
         {
@@ -358,7 +360,7 @@ workspaceSwitch (ScreenInfo *screen_info, int new_ws, Client * c2, gboolean upda
             }
             FLAG_UNSET (c->xfwm_flags, XFWM_FLAG_FOCUS);
         }
-        else if (c->win_workspace == new_ws)
+        else if (new_ws == (gint) c->win_workspace)
         {
             if ((!new_focus) && FLAG_TEST (c->xfwm_flags, XFWM_FLAG_FOCUS))
             {
@@ -423,11 +425,11 @@ workspaceSetNames (ScreenInfo * screen_info, gchar **names, int items)
 }
 
 void
-workspaceSetCount (ScreenInfo * screen_info, int count)
+workspaceSetCount (ScreenInfo * screen_info, guint count)
 {
     DisplayInfo *display_info;
     Client *c;
-    int i;
+    guint i;
 
     g_return_if_fail (screen_info != NULL);
 
@@ -466,10 +468,10 @@ workspaceSetCount (ScreenInfo * screen_info, int count)
 }
 
 void
-workspaceInsert (ScreenInfo * screen_info, int index)
+workspaceInsert (ScreenInfo * screen_info, guint position)
 {
     Client *c;
-    int i, count;
+    guint i, count;
 
     g_return_if_fail (screen_info != NULL);
 
@@ -478,14 +480,14 @@ workspaceInsert (ScreenInfo * screen_info, int index)
     count = screen_info->workspace_count;
     workspaceSetCount(screen_info, count + 1);
 
-    if ((index < 0) || (index > count))
+    if (position > count)
     {
         return;
     }
 
     for (c = screen_info->clients, i = 0; i < screen_info->client_count; c = c->next, i++)
     {
-        if (c->win_workspace >= index)
+        if (c->win_workspace >= position)
         {
             clientSetWorkspace (c, c->win_workspace + 1, TRUE);
         }
@@ -493,24 +495,24 @@ workspaceInsert (ScreenInfo * screen_info, int index)
 }
 
 void
-workspaceDelete (ScreenInfo * screen_info, int index)
+workspaceDelete (ScreenInfo * screen_info, guint position)
 {
     Client *c;
-    int i, count;
+    guint i, count;
 
     g_return_if_fail (screen_info != NULL);
 
     TRACE ("entering workspaceDelete");
 
     count = screen_info->workspace_count;
-    if ((index < 0) || (index > count))
+    if ((count < 1) || (position > count))
     {
         return;
     }
 
     for (c = screen_info->clients, i = 0; i < screen_info->client_count; c = c->next, i++)
     {
-        if (c->win_workspace > index)
+        if (c->win_workspace > position)
         {
             clientSetWorkspace (c, c->win_workspace - 1, TRUE);
         }
@@ -528,7 +530,7 @@ workspaceUpdateArea (ScreenInfo *screen_info)
     int prev_left;
     int prev_right;
     int prev_bottom;
-    int i;
+    guint i;
 
     g_return_if_fail (screen_info != NULL);
     g_return_if_fail (screen_info->margins != NULL);
diff --git a/src/workspaces.h b/src/workspaces.h
index ad43a28..c45f797 100644
--- a/src/workspaces.h
+++ b/src/workspaces.h
@@ -51,13 +51,13 @@ void                    workspaceSetNames                       (ScreenInfo *,
                                                                  gchar **,
                                                                  int);
 void                    workspaceSetCount                       (ScreenInfo *,
-                                                                 int);
+                                                                 guint);
 void                    workspaceUpdateArea                     (ScreenInfo *);
 
 void                    workspaceInsert                         (ScreenInfo *,
-                                                                 int);
+                                                                 guint);
 
 void                    workspaceDelete                         (ScreenInfo *,
-                                                                 int);
+                                                                 guint);
 
 #endif /* INC_WORKSPACES_H */



More information about the Xfce4-commits mailing list