From 32d4bd6b63a9a5fe044248740e2dfa9050c1fbb6 Mon Sep 17 00:00:00 2001 From: Elijah Newren Date: Fri, 20 Jan 2006 22:03:56 +0000 Subject: [PATCH] Patch from Kjartan Maraas to fix a lot of tiny issues (unused variable 2006-01-20 Elijah Newren * src/async-getprop.c: * src/common.h: * src/display.c: * src/eggaccelerators.c: * src/frames.c: * src/gradient.c: * src/iconcache.c: * src/keybindings.c: * src/metaaccellabel.c: * src/place.c: * src/prefs.c: * src/preview-widget.c: * src/screen.c: * src/session.c: * src/stack.c: * src/tabpopup.c: * src/theme-viewer.c: * src/theme.c: * src/window-props.c: * src/window.c: * src/workspace.c: * src/tools/metacity-window-demo.c: * src/wm-tester/test-gravity.c: * src/wm-tester/test-resizing.c: * src/wm-tester/test-size-hints.c: Patch from Kjartan Maraas to fix a lot of tiny issues (unused variable removal, making unused variables used again, correction of types passed/declared for printf arguments, removal of unneeded breaks and returns, dead code removal, dead code revival, renaming to prevent shadowed variables, declaring unexported functions as static) spotted by the intel compiler. #321439 --- ChangeLog | 34 +++++++++++++++ src/async-getprop.c | 3 -- src/display.c | 73 +++++++++++++++----------------- src/eggaccelerators.c | 2 +- src/frames.c | 30 +------------ src/gradient.c | 9 ---- src/iconcache.c | 3 -- src/keybindings.c | 4 +- src/metaaccellabel.c | 2 - src/place.c | 1 - src/prefs.c | 12 ++---- src/preview-widget.c | 6 --- src/screen.c | 6 +-- src/session.c | 15 ------- src/stack.c | 16 +++---- src/tabpopup.c | 16 +++---- src/theme-viewer.c | 14 ++---- src/theme.c | 3 -- src/tools/metacity-window-demo.c | 2 +- src/window-props.c | 2 +- src/window.c | 59 ++++++++------------------ src/wm-tester/test-gravity.c | 37 ++++++---------- src/wm-tester/test-resizing.c | 6 ++- src/wm-tester/test-size-hints.c | 6 ++- src/workspace.c | 2 +- 25 files changed, 140 insertions(+), 223 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3bf848766..949646980 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,37 @@ +2006-01-20 Elijah Newren + + * src/async-getprop.c: + * src/common.h: + * src/display.c: + * src/eggaccelerators.c: + * src/frames.c: + * src/gradient.c: + * src/iconcache.c: + * src/keybindings.c: + * src/metaaccellabel.c: + * src/place.c: + * src/prefs.c: + * src/preview-widget.c: + * src/screen.c: + * src/session.c: + * src/stack.c: + * src/tabpopup.c: + * src/theme-viewer.c: + * src/theme.c: + * src/window-props.c: + * src/window.c: + * src/workspace.c: + * src/tools/metacity-window-demo.c: + * src/wm-tester/test-gravity.c: + * src/wm-tester/test-resizing.c: + * src/wm-tester/test-size-hints.c: + Patch from Kjartan Maraas to fix a lot of tiny issues (unused + variable removal, making unused variables used again, correction + of types passed/declared for printf arguments, removal of unneeded + breaks and returns, dead code removal, dead code revival, renaming + to prevent shadowed variables, declaring unexported functions as + static) spotted by the intel compiler. #321439 + 2006-01-20 Elijah Newren Patch from Björn Lindqvist to fix #98340. diff --git a/src/async-getprop.c b/src/async-getprop.c index f34ea0cd6..d5a4b289c 100644 --- a/src/async-getprop.c +++ b/src/async-getprop.c @@ -522,7 +522,6 @@ ag_task_create (Display *dpy, { AgGetPropertyTask *task; xGetPropertyReq *req; - xError error; AgPerDisplayData *dd; /* Fire up our request */ @@ -543,8 +542,6 @@ ag_task_create (Display *dpy, req->longOffset = offset; req->longLength = length; - error.sequenceNumber = dpy->request; - /* Queue up our async task */ task = Xcalloc (1, sizeof (AgGetPropertyTask)); if (task == NULL) diff --git a/src/display.c b/src/display.c index fca268548..fbf6d4b68 100644 --- a/src/display.c +++ b/src/display.c @@ -621,13 +621,9 @@ meta_display_open (const char *name) * that will follow. */ { - XSetWindowAttributes attrs; gulong data[1]; XEvent event; - attrs.event_mask = PropertyChangeMask; - attrs.override_redirect = True; - display->leader_window = meta_create_offscreen_window (display->xdisplay, DefaultRootWindow (display->xdisplay)); @@ -1067,7 +1063,6 @@ grab_op_is_mouse (MetaGrabOp op) case META_GRAB_OP_KEYBOARD_RESIZING_NW: case META_GRAB_OP_KEYBOARD_MOVING: return TRUE; - break; default: return FALSE; @@ -1095,7 +1090,6 @@ grab_op_is_keyboard (MetaGrabOp op) case META_GRAB_OP_KEYBOARD_ESCAPING_DOCK: case META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING: return TRUE; - break; default: return FALSE; @@ -1125,7 +1119,6 @@ meta_grab_op_is_resizing (MetaGrabOp op) case META_GRAB_OP_KEYBOARD_RESIZING_SW: case META_GRAB_OP_KEYBOARD_RESIZING_NW: return TRUE; - break; default: return FALSE; @@ -1140,7 +1133,6 @@ meta_grab_op_is_moving (MetaGrabOp op) case META_GRAB_OP_MOVING: case META_GRAB_OP_KEYBOARD_MOVING: return TRUE; - break; default: return FALSE; @@ -1267,6 +1259,7 @@ window_raise_with_delay_callback (void *data) Window root, child; unsigned int mask; gboolean same_screen; + gboolean point_in_window; meta_error_trap_push (window->display); same_screen = XQueryPointer (window->display->xdisplay, @@ -1275,8 +1268,10 @@ window_raise_with_delay_callback (void *data) &root_x, &root_y, &x, &y, &mask); meta_error_trap_pop (window->display, TRUE); - if ((window->frame && POINT_IN_RECT (root_x, root_y, window->frame->rect)) || - (window->frame == NULL && POINT_IN_RECT (root_x, root_y, window->rect))) + point_in_window = + (window->frame && POINT_IN_RECT (root_x, root_y, window->frame->rect)) || + (window->frame == NULL && POINT_IN_RECT (root_x, root_y, window->rect)); + if (same_screen && point_in_window) meta_window_raise (window); else meta_topic (META_DEBUG_FOCUS, @@ -1629,7 +1624,7 @@ event_callback (XEvent *event, grab_op_is_keyboard (display->grab_op)) { meta_topic (META_DEBUG_WINDOW_OPS, - "Ending grab op %d on window %s due to button press\n", + "Ending grab op %u on window %s due to button press\n", display->grab_op, (display->grab_window ? display->grab_window->desc : @@ -1685,7 +1680,7 @@ event_callback (XEvent *event, if (window->type != META_WINDOW_DOCK) { meta_topic (META_DEBUG_FOCUS, - "Focusing %s due to unmodified button %d press (display.c)\n", + "Focusing %s due to unmodified button %u press (display.c)\n", window->desc, event->xbutton.button); meta_window_focus (window, event->xbutton.time); } @@ -2200,7 +2195,6 @@ event_callback (XEvent *event, * closing the display... so return right away. */ return FALSE; - break; case SelectionRequest: process_selection_request (display, event); break; @@ -2699,7 +2693,7 @@ meta_spew_event (MetaDisplay *display, break; case ButtonPress: name = "ButtonPress"; - extra = g_strdup_printf ("button %d state 0x%x x %d y %d root 0x%lx same_screen %d", + extra = g_strdup_printf ("button %u state 0x%x x %d y %d root 0x%lx same_screen %d", event->xbutton.button, event->xbutton.state, event->xbutton.x, @@ -2709,7 +2703,7 @@ meta_spew_event (MetaDisplay *display, break; case ButtonRelease: name = "ButtonRelease"; - extra = g_strdup_printf ("button %d state 0x%x x %d y %d root 0x%lx same_screen %d", + extra = g_strdup_printf ("button %u state 0x%x x %d y %d root 0x%lx same_screen %d", event->xbutton.button, event->xbutton.state, event->xbutton.x, @@ -2951,7 +2945,7 @@ meta_spew_event (MetaDisplay *display, extra = g_strdup_printf ("kind: %s " - "x: %d y: %d w: %d h: %d " + "x: %d y: %d w: %u h: %u " "shaped: %d", sev->kind == ShapeBounding ? "ShapeBounding" : @@ -3235,13 +3229,13 @@ meta_display_begin_grab_op (MetaDisplay *display, Window grab_xwindow; meta_topic (META_DEBUG_WINDOW_OPS, - "Doing grab op %d on window %s button %d pointer already grabbed: %d pointer pos %d,%d\n", + "Doing grab op %u on window %s button %d pointer already grabbed: %d pointer pos %d,%d\n", op, window ? window->desc : "none", button, pointer_already_grabbed, root_x, root_y); if (display->grab_op != META_GRAB_OP_NONE) { - meta_warning ("Attempt to perform window operation %d on window %s when operation %d on %s already in effect\n", + meta_warning ("Attempt to perform window operation %u on window %s when operation %u on %s already in effect\n", op, window ? window->desc : "none", display->grab_op, display->grab_window ? display->grab_window->desc : "none"); return FALSE; @@ -3414,7 +3408,7 @@ meta_display_begin_grab_op (MetaDisplay *display, } meta_topic (META_DEBUG_WINDOW_OPS, - "Grab op %d on window %s successful\n", + "Grab op %u on window %s successful\n", display->grab_op, window ? window->desc : "(null)"); g_assert (display->grab_window != NULL || display->grab_screen != NULL); @@ -3488,7 +3482,7 @@ meta_display_end_grab_op (MetaDisplay *display, Time timestamp) { meta_topic (META_DEBUG_WINDOW_OPS, - "Ending grab op %d at time %lu\n", display->grab_op, + "Ending grab op %u at time %lu\n", display->grab_op, (unsigned long) timestamp); if (display->grab_op == META_GRAB_OP_NONE) @@ -4087,7 +4081,7 @@ process_request_frame_extents (MetaDisplay *display, meta_topic (META_DEBUG_GEOMETRY, "Setting _NET_FRAME_EXTENTS on unmanaged window 0x%lx " - "to top = %ld, left = %ld, bottom = %ld, right = %ld\n", + "to top = %lu, left = %lu, bottom = %lu, right = %lu\n", xwindow, data[0], data[1], data[2], data[3]); meta_error_trap_push (display); @@ -4309,6 +4303,7 @@ meta_display_get_tab_next (MetaDisplay *display, { gboolean skip; GList *tab_list; + MetaWindow *ret; tab_list = meta_display_get_tab_list(display, type, screen, @@ -4322,27 +4317,30 @@ meta_display_get_tab_next (MetaDisplay *display, g_assert (window->display == display); if (backward) - return find_tab_backward (display, type, screen, workspace, - g_list_find (tab_list, - window), - TRUE); - else - return find_tab_forward (display, type, screen, workspace, + ret = find_tab_backward (display, type, screen, workspace, g_list_find (tab_list, window), TRUE); + else + ret = find_tab_forward (display, type, screen, workspace, + g_list_find (tab_list, + window), + TRUE); + } + else + { + skip = display->focus_window != NULL && + IN_TAB_CHAIN (display->focus_window, type); + if (backward) + ret = find_tab_backward (display, type, screen, workspace, + tab_list, skip); + else + ret = find_tab_forward (display, type, screen, workspace, + tab_list, skip); } - skip = display->focus_window != NULL && - IN_TAB_CHAIN (display->focus_window, type); - if (backward) - return find_tab_backward (display, type, screen, workspace, - tab_list, skip); - else - return find_tab_forward (display, type, screen, workspace, - tab_list, skip); - g_list_free (tab_list); + return ret; } MetaWindow* @@ -4846,9 +4844,6 @@ timestamp_too_old (MetaDisplay *display, * timestamp_too_old_or_in_future). */ - MetaWindow *focus_window; - focus_window = display->focus_window; - if (*timestamp == CurrentTime) { meta_warning ("Got a request to focus %s with a timestamp of 0. This " diff --git a/src/eggaccelerators.c b/src/eggaccelerators.c index ca63e7815..5f33dcf75 100644 --- a/src/eggaccelerators.c +++ b/src/eggaccelerators.c @@ -45,7 +45,7 @@ typedef struct } EggModmap; -const EggModmap* egg_keymap_get_modmap (GdkKeymap *keymap); +static const EggModmap* egg_keymap_get_modmap (GdkKeymap *keymap); static inline gboolean is_alt (const gchar *string) diff --git a/src/frames.c b/src/frames.c index 6b2e629af..46a4ea648 100644 --- a/src/frames.c +++ b/src/frames.c @@ -640,10 +640,6 @@ meta_frames_unmanage_window (MetaFrames *frames, static void meta_frames_realize (GtkWidget *widget) { - MetaFrames *frames; - - frames = META_FRAMES (widget); - if (GTK_WIDGET_CLASS (parent_class)->realize) GTK_WIDGET_CLASS (parent_class)->realize (widget); } @@ -651,10 +647,6 @@ meta_frames_realize (GtkWidget *widget) static void meta_frames_unrealize (GtkWidget *widget) { - MetaFrames *frames; - - frames = META_FRAMES (widget); - if (GTK_WIDGET_CLASS (parent_class)->unrealize) GTK_WIDGET_CLASS (parent_class)->unrealize (widget); } @@ -709,11 +701,8 @@ void meta_frames_reset_bg (MetaFrames *frames, Window xwindow) { - GtkWidget *widget; MetaUIFrame *frame; - widget = GTK_WIDGET (frames); - frame = meta_frames_lookup_window (frames, xwindow); meta_frames_set_window_background (frames, frame); @@ -736,11 +725,8 @@ meta_frames_unflicker_bg (MetaFrames *frames, int target_width, int target_height) { - GtkWidget *widget; MetaUIFrame *frame; - widget = GTK_WIDGET (frames); - frame = meta_frames_lookup_window (frames, xwindow); g_return_if_fail (frame != NULL); @@ -766,15 +752,12 @@ meta_frames_apply_shapes (MetaFrames *frames, { #ifdef HAVE_SHAPE /* Apply shapes as if window had new_window_width, new_window_height */ - GtkWidget *widget; MetaUIFrame *frame; MetaFrameGeometry fgeom; XRectangle xrect; Region corners_xregion; Region window_xregion; - widget = GTK_WIDGET (frames); - frame = meta_frames_lookup_window (frames, xwindow); g_return_if_fail (frame != NULL); @@ -1036,11 +1019,8 @@ void meta_frames_queue_draw (MetaFrames *frames, Window xwindow) { - GtkWidget *widget; MetaUIFrame *frame; - widget = GTK_WIDGET (frames); - frame = meta_frames_lookup_window (frames, xwindow); invalidate_whole_window (frames, frame); @@ -1051,11 +1031,8 @@ meta_frames_set_title (MetaFrames *frames, Window xwindow, const char *title) { - GtkWidget *widget; MetaUIFrame *frame; - widget = GTK_WIDGET (frames); - frame = meta_frames_lookup_window (frames, xwindow); g_assert (frame); @@ -1076,11 +1053,8 @@ void meta_frames_repaint_frame (MetaFrames *frames, Window xwindow) { - GtkWidget *widget; MetaUIFrame *frame; - widget = GTK_WIDGET (frames); - frame = meta_frames_lookup_window (frames, xwindow); g_assert (frame); @@ -1307,8 +1281,6 @@ meta_frames_button_press_event (GtkWidget *widget, case META_ACTION_DOUBLE_CLICK_TITLEBAR_TOGGLE_MAXIMIZE: { - MetaFrameFlags flags; - flags = meta_core_get_frame_flags (gdk_display, frame->xwindow); if (flags & META_FRAME_ALLOWS_MAXIMIZE) @@ -1628,7 +1600,7 @@ meta_frames_update_prelit_control (MetaFrames *frames, MetaFrameControl old_control; MetaCursor cursor; - meta_verbose ("Updating prelit control from %d to %d\n", + meta_verbose ("Updating prelit control from %u to %u\n", frame->prelit_control, control); cursor = META_CURSOR_DEFAULT; diff --git a/src/gradient.c b/src/gradient.c index 3cd2ed6f8..f61d95584 100644 --- a/src/gradient.c +++ b/src/gradient.c @@ -401,8 +401,6 @@ meta_gradient_create_diagonal (int width, int height, int j; float a, offset; unsigned char *ptr; - int r0, g0, b0; - int rf, gf, bf; unsigned char *pixels; int rowstride; @@ -425,13 +423,6 @@ meta_gradient_create_diagonal (int width, int height, return NULL; } - r0 = (guchar) (from->red / 256.0); - g0 = (guchar) (from->green / 256.0); - b0 = (guchar) (from->blue / 256.0); - rf = (guchar) (to->red / 256.0); - gf = (guchar) (to->green / 256.0); - bf = (guchar) (to->blue / 256.0); - ptr = gdk_pixbuf_get_pixels (tmp); a = ((float)(width - 1))/((float)(height - 1)); diff --git a/src/iconcache.c b/src/iconcache.c index 0be581bf1..eca5db07f 100644 --- a/src/iconcache.c +++ b/src/iconcache.c @@ -56,9 +56,6 @@ find_largest_sizes (gulong *data, while (nitems > 0) { int w, h; - gboolean replace; - - replace = FALSE; if (nitems < 3) return FALSE; /* no space for w, h */ diff --git a/src/keybindings.c b/src/keybindings.c index 1477b7e34..7c8e7aa12 100644 --- a/src/keybindings.c +++ b/src/keybindings.c @@ -1684,7 +1684,7 @@ meta_display_process_key_event (MetaDisplay *display, if (!handled) { meta_topic (META_DEBUG_KEYBINDINGS, - "Ending grab op %d on key event sym %s\n", + "Ending grab op %u on key event sym %s\n", display->grab_op, XKeysymToString (keysym)); meta_display_end_grab_op (display, event->xkey.time); } @@ -2912,7 +2912,7 @@ do_choose_window (MetaDisplay *display, type = GPOINTER_TO_INT (binding->handler->data); meta_topic (META_DEBUG_KEYBINDINGS, - "Tab list = %d show_popup = %d\n", type, show_popup); + "Tab list = %u show_popup = %d\n", type, show_popup); /* reverse direction if shift is down */ if (event->xkey.state & ShiftMask) diff --git a/src/metaaccellabel.c b/src/metaaccellabel.c index e6fbf6f63..0d197c5ac 100644 --- a/src/metaaccellabel.c +++ b/src/metaaccellabel.c @@ -49,7 +49,6 @@ static void meta_accel_label_update (MetaAccelLabel *accel_label); static int meta_accel_label_get_accel_width (MetaAccelLabel *accel_label); -static MetaAccelLabelClass *accel_label_class = NULL; static GtkLabelClass *parent_class = NULL; @@ -85,7 +84,6 @@ meta_accel_label_class_init (MetaAccelLabelClass *class) GtkObjectClass *object_class = GTK_OBJECT_CLASS (class); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class); - accel_label_class = class; parent_class = g_type_class_peek_parent (class); gobject_class->finalize = meta_accel_label_finalize; diff --git a/src/place.c b/src/place.c index befcbe576..c6ffef6a8 100644 --- a/src/place.c +++ b/src/place.c @@ -738,7 +738,6 @@ meta_window_place (MetaWindow *window, case META_WINDOW_MENU: case META_WINDOW_UTILITY: goto done_no_constraints; - break; } if (meta_prefs_get_disable_workarounds ()) diff --git a/src/prefs.c b/src/prefs.c index 48530ec64..3ea803218 100644 --- a/src/prefs.c +++ b/src/prefs.c @@ -1583,36 +1583,30 @@ meta_preference_to_string (MetaPreference pref) case META_PREF_BUTTON_LAYOUT: return "BUTTON_LAYOUT"; - break; case META_PREF_WORKSPACE_NAMES: return "WORKSPACE_NAMES"; - break; case META_PREF_VISUAL_BELL: return "VISUAL_BELL"; - break; case META_PREF_AUDIBLE_BELL: return "AUDIBLE_BELL"; - break; case META_PREF_VISUAL_BELL_TYPE: return "VISUAL_BELL_TYPE"; - break; case META_PREF_REDUCED_RESOURCES: return "REDUCED_RESOURCES"; - break; + case META_PREF_GNOME_ACCESSIBILITY: return "GNOME_ACCESSIBILTY"; - break; + case META_PREF_CURSOR_THEME: return "CURSOR_THEME"; - break; + case META_PREF_CURSOR_SIZE: return "CURSOR_SIZE"; - break; } return "(unknown)"; diff --git a/src/preview-widget.c b/src/preview-widget.c index 30ef28623..8038c5fb3 100644 --- a/src/preview-widget.c +++ b/src/preview-widget.c @@ -62,10 +62,8 @@ static void meta_preview_class_init (MetaPreviewClass *class) { GObjectClass *gobject_class = G_OBJECT_CLASS (class); - GtkObjectClass *object_class; GtkWidgetClass *widget_class; - object_class = (GtkObjectClass*) class; widget_class = (GtkWidgetClass*) class; parent_class = gtk_type_class (GTK_TYPE_BIN); @@ -128,10 +126,6 @@ meta_preview_new (void) static void meta_preview_finalize (GObject *object) { - MetaPreview *preview; - - preview = META_PREVIEW (object); - G_OBJECT_CLASS (parent_class)->finalize (object); } diff --git a/src/screen.c b/src/screen.c index 469f2a4dd..003b04a15 100644 --- a/src/screen.c +++ b/src/screen.c @@ -982,7 +982,7 @@ set_number_of_spaces_hint (MetaScreen *screen, data[0] = n_spaces; - meta_verbose ("Setting _NET_NUMBER_OF_DESKTOPS to %ld\n", data[0]); + meta_verbose ("Setting _NET_NUMBER_OF_DESKTOPS to %lu\n", data[0]); meta_error_trap_push (screen->display); XChangeProperty (screen->display->xdisplay, screen->xroot, @@ -1003,7 +1003,7 @@ set_desktop_geometry_hint (MetaScreen *screen) data[0] = screen->rect.width; data[1] = screen->rect.height; - meta_verbose ("Setting _NET_DESKTOP_GEOMETRY to %ld, %ld\n", data[0], data[1]); + meta_verbose ("Setting _NET_DESKTOP_GEOMETRY to %lu, %lu\n", data[0], data[1]); meta_error_trap_push (screen->display); XChangeProperty (screen->display->xdisplay, screen->xroot, @@ -1672,7 +1672,7 @@ meta_screen_update_workspace_layout (MetaScreen *screen) meta_XFree (list); } - meta_verbose ("Workspace layout rows = %d cols = %d orientation = %d starting corner = %d\n", + meta_verbose ("Workspace layout rows = %d cols = %d orientation = %d starting corner = %u\n", screen->rows_of_workspaces, screen->columns_of_workspaces, screen->vertical_workspaces, diff --git a/src/session.c b/src/session.c index e4a08b340..0f87b9889 100644 --- a/src/session.c +++ b/src/session.c @@ -673,31 +673,22 @@ window_type_to_string (MetaWindowType type) { case META_WINDOW_NORMAL: return "normal"; - break; case META_WINDOW_DESKTOP: return "desktop"; - break; case META_WINDOW_DOCK: return "dock"; - break; case META_WINDOW_DIALOG: return "dialog"; - break; case META_WINDOW_MODAL_DIALOG: return "modal_dialog"; - break; case META_WINDOW_TOOLBAR: return "toolbar"; - break; case META_WINDOW_MENU: return "menu"; - break; case META_WINDOW_SPLASHSCREEN: return "splashscreen"; - break; case META_WINDOW_UTILITY: return "utility"; - break; } return ""; @@ -1485,10 +1476,6 @@ text_handler (GMarkupParseContext *context, gpointer user_data, GError **error) { - ParseData *pd; - - pd = user_data; - /* Right now we don't have any elements where we care about their * content */ @@ -1617,8 +1604,6 @@ find_best_match (GSList *infos, return matching_type; else return infos->data; - - return NULL; } const MetaWindowSessionInfo* diff --git a/src/stack.c b/src/stack.c index 80ebfb95b..b3bd203e7 100644 --- a/src/stack.c +++ b/src/stack.c @@ -367,13 +367,13 @@ compute_layer (MetaWindow *window) if (group_max > window->layer) { meta_topic (META_DEBUG_STACK, - "Promoting window %s from layer %d to %d due to group membership\n", + "Promoting window %s from layer %u to %u due to group membership\n", window->desc, window->layer, group_max); window->layer = group_max; } } - meta_topic (META_DEBUG_STACK, "Window %s on layer %d type = %d has_focus = %d\n", + meta_topic (META_DEBUG_STACK, "Window %s on layer %u type = %u has_focus = %d\n", window->desc, window->layer, window->type, window->has_focus); } @@ -667,7 +667,7 @@ ensure_above (MetaWindow *above, above->layer < below->layer) { meta_topic (META_DEBUG_STACK, - "Promoting window %s from layer %d to %d due to contraint\n", + "Promoting window %s from layer %u to %u due to contraint\n", above->desc, above->layer, below->layer); above->layer = below->layer; } @@ -887,7 +887,7 @@ meta_stack_ensure_sorted (MetaStack *stack) if (w->layer != old_layer) { meta_topic (META_DEBUG_STACK, - "Window %s moved from layer %d to %d\n", + "Window %s moved from layer %u to %u\n", w->desc, old_layer, w->layer); stack->need_resort = TRUE; @@ -939,7 +939,7 @@ raise_window_relative_to_managed_windows (MetaScreen *screen, Window ignored1, ignored2; Window *children; - int n_children; + unsigned int n_children; int i; /* Normally XQueryTree() means "must grab server" but here @@ -1063,7 +1063,7 @@ meta_stack_sync_to_server (MetaStack *stack) else g_array_append_val (root_children_stacked, w->xwindow); - meta_topic (META_DEBUG_STACK, "%d:%d - %s ", w->layer, w->stack_position, w->desc); + meta_topic (META_DEBUG_STACK, "%u:%d - %s ", w->layer, w->stack_position, w->desc); tmp = tmp->next; } @@ -1073,12 +1073,12 @@ meta_stack_sync_to_server (MetaStack *stack) /* All windows should be in some stacking order */ if (stacked->len != stack->windows->len) - meta_bug ("%d windows stacked, %d windows exist in stack\n", + meta_bug ("%u windows stacked, %u windows exist in stack\n", stacked->len, stack->windows->len); /* Sync to server */ - meta_topic (META_DEBUG_STACK, "Restacking %d windows\n", + meta_topic (META_DEBUG_STACK, "Restacking %u windows\n", root_children_stacked->len); meta_error_trap_push (stack->screen->display); diff --git a/src/tabpopup.c b/src/tabpopup.c index 65b1568a3..33f320343 100644 --- a/src/tabpopup.c +++ b/src/tabpopup.c @@ -205,28 +205,28 @@ meta_ui_tab_popup_new (const MetaTabEntry *entries, te->title = NULL; if (entries[i].title) { - gchar *tmp; + gchar *temp; if (entries[i].hidden) { - tmp = g_markup_printf_escaped ("[%s]", entries[i].title); + temp = g_markup_printf_escaped ("[%s]", entries[i].title); } else { - tmp = g_markup_printf_escaped ("%s", entries[i].title); + temp = g_markup_printf_escaped ("%s", entries[i].title); } if (entries[i].demands_attention) { gchar *escaped, *markup; - escaped = g_markup_escape_text (tmp, -1); + escaped = g_markup_escape_text (temp, -1); markup = g_strdup_printf ("%s", escaped); g_free (escaped); - g_free (tmp); - tmp = markup; + g_free (temp); + temp = markup; } - te->title = meta_g_utf8_strndup (tmp, max_chars_per_title); - g_free (tmp); + te->title = meta_g_utf8_strndup (temp, max_chars_per_title); + g_free (temp); } te->widget = NULL; te->icon = entries[i].icon; diff --git a/src/theme-viewer.c b/src/theme-viewer.c index af2ebf2b6..bb081d9b0 100644 --- a/src/theme-viewer.c +++ b/src/theme-viewer.c @@ -61,7 +61,9 @@ static GtkWidget *previews[META_FRAME_TYPE_LAST*FONT_SIZE_LAST + BUTTON_LAYOUT_C static double milliseconds_to_draw_frame = 0.0; static void run_position_expression_tests (void); +#if 0 static void run_position_expression_timings (void); +#endif static void run_theme_benchmark (void); @@ -90,7 +92,6 @@ normal_contents (void) GtkWidget *statusbar; GtkWidget *contents; GtkWidget *sw; - GtkTextBuffer *buffer; GtkItemFactory *item_factory; table = gtk_table_new (1, 4, FALSE); @@ -194,9 +195,6 @@ normal_contents (void) GTK_EXPAND | GTK_FILL, 0, 0, 0); - /* Show text widget info in the statusbar */ - buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (contents)); - gtk_widget_show_all (table); return table; @@ -376,32 +374,26 @@ get_window_contents (MetaFrameType type, case META_FRAME_TYPE_NORMAL: *title = _("Normal Application Window"); return normal_contents (); - break; case META_FRAME_TYPE_DIALOG: *title = _("Dialog Box"); return dialog_contents (); - break; case META_FRAME_TYPE_MODAL_DIALOG: *title = _("Modal Dialog Box"); return dialog_contents (); - break; case META_FRAME_TYPE_UTILITY: *title = _("Utility Palette"); return utility_contents (); - break; case META_FRAME_TYPE_MENU: *title = _("Torn-off Menu"); return menu_contents (); - break; case META_FRAME_TYPE_BORDER: *title = _("Border"); return border_only_contents (); - break; case META_FRAME_TYPE_LAST: g_assert_not_reached (); @@ -1255,6 +1247,7 @@ run_position_expression_tests (void) } } +#if 0 static void run_position_expression_timings (void) { @@ -1313,3 +1306,4 @@ run_position_expression_timings (void) ((double)end - (double)start) / CLOCKS_PER_SEC / (double) ITERATIONS); } +#endif diff --git a/src/theme.c b/src/theme.c index 0c65226ca..4165dc8ae 100644 --- a/src/theme.c +++ b/src/theme.c @@ -289,7 +289,6 @@ meta_frame_layout_validate (const MetaFrameLayout *layout, META_THEME_ERROR_FRAME_GEOMETRY, _("Frame geometry does not specify size of buttons")); return FALSE; - break; } CHECK_GEOMETRY_BORDER (button_border); @@ -1776,7 +1775,6 @@ do_operation (PosExpr *a, META_THEME_ERROR_MOD_ON_FLOAT, _("Coordinate expression tries to use mod operator on a floating-point number")); return FALSE; - break; case POS_OP_ADD: a->d.double_val = a->d.double_val + b->d.double_val; break; @@ -2008,7 +2006,6 @@ pos_eval_helper (PosToken *tokens, META_THEME_ERROR_BAD_PARENS, _("Coordinate expression had a close parenthesis with no open parenthesis")); return FALSE; - break; case POS_TOKEN_VARIABLE: exprs[n_exprs].type = POS_EXPR_INT; diff --git a/src/tools/metacity-window-demo.c b/src/tools/metacity-window-demo.c index 75152dda7..0685b1f35 100644 --- a/src/tools/metacity-window-demo.c +++ b/src/tools/metacity-window-demo.c @@ -26,7 +26,7 @@ static GtkWidget* do_appwindow (void); -gboolean aspect_on; +static gboolean aspect_on; static void set_gdk_window_struts (GdkWindow *window, diff --git a/src/window-props.c b/src/window-props.c index 0d86c035b..7dbcb94bd 100644 --- a/src/window-props.c +++ b/src/window-props.c @@ -166,7 +166,7 @@ reload_net_wm_pid (MetaWindow *window, gulong cardinal = (int) value->v.cardinal; if (cardinal <= 0) - meta_warning (_("Application set a bogus _NET_WM_PID %ld\n"), + meta_warning (_("Application set a bogus _NET_WM_PID %lu\n"), cardinal); else { diff --git a/src/window.c b/src/window.c index 74ff58c2d..627a41656 100644 --- a/src/window.c +++ b/src/window.c @@ -88,7 +88,7 @@ static void ensure_mru_position_after (MetaWindow *window, MetaWindow *after_this_one); -void meta_window_move_resize_now (MetaWindow *window); +static void meta_window_move_resize_now (MetaWindow *window); static void update_move (MetaWindow *window, gboolean snap, @@ -105,15 +105,13 @@ static gboolean update_resize_timeout (gpointer data); /* FIXME we need an abstraction that covers all these queues. */ -void meta_window_unqueue_calc_showing (MetaWindow *window); -void meta_window_flush_calc_showing (MetaWindow *window); +static void meta_window_unqueue_calc_showing (MetaWindow *window); +static void meta_window_flush_calc_showing (MetaWindow *window); -void meta_window_unqueue_move_resize (MetaWindow *window); -void meta_window_flush_move_resize (MetaWindow *window); +static void meta_window_unqueue_move_resize (MetaWindow *window); static void meta_window_update_icon_now (MetaWindow *window); -void meta_window_unqueue_update_icon (MetaWindow *window); -void meta_window_flush_update_icon (MetaWindow *window); +static void meta_window_unqueue_update_icon (MetaWindow *window); static gboolean queue_calc_showing_func (MetaWindow *window, void *data); @@ -326,7 +324,7 @@ meta_window_new_with_attrs (MetaDisplay *display, has_shape = bounding_shaped != FALSE; meta_topic (META_DEBUG_SHAPES, - "Window has_shape = %d extents %d,%d %d x %d\n", + "Window has_shape = %d extents %d,%d %u x %u\n", has_shape, x_bounding, y_bounding, w_bounding, h_bounding); } @@ -1569,7 +1567,7 @@ idle_calc_showing (gpointer data) return FALSE; } -void +static void meta_window_unqueue_calc_showing (MetaWindow *window) { if (!window->calc_showing_queued) @@ -1593,7 +1591,7 @@ meta_window_unqueue_calc_showing (MetaWindow *window) } } -void +static void meta_window_flush_calc_showing (MetaWindow *window) { if (window->calc_showing_queued) @@ -1829,7 +1827,6 @@ windows_overlap (const MetaWindow *w1, const MetaWindow *w2) void meta_window_show (MetaWindow *window) { - gboolean did_placement; gboolean did_show; gboolean takes_focus_on_map; gboolean place_on_top_on_map; @@ -1842,7 +1839,6 @@ meta_window_show (MetaWindow *window) focus_window = window->display->focus_window; /* May be NULL! */ did_show = FALSE; - did_placement = FALSE; window_state_on_map (window, &takes_focus_on_map, &place_on_top_on_map); needs_stacking_adjustment = FALSE; @@ -1898,7 +1894,6 @@ meta_window_show (MetaWindow *window) * still get placed when they are ultimately shown. */ window->placed = TRUE; - did_placement = TRUE; /* Don't want to accidentally reuse the fact that we had been denied * focus in any future constraints unless we're denied focus again. @@ -3221,7 +3216,7 @@ meta_window_resize_with_gravity (MetaWindow *window, x, y, w, h); } -void +static void meta_window_move_resize_now (MetaWindow *window) { int x, y; @@ -3284,7 +3279,7 @@ idle_move_resize (gpointer data) return FALSE; } -void +static void meta_window_unqueue_move_resize (MetaWindow *window) { if (!window->move_resize_queued) @@ -3308,16 +3303,6 @@ meta_window_unqueue_move_resize (MetaWindow *window) } } -void -meta_window_flush_move_resize (MetaWindow *window) -{ - if (window->move_resize_queued) - { - meta_window_unqueue_move_resize (window); - meta_window_move_resize_now (window); - } -} - /* The move/resize queue is only used when we need to * recheck the constraints on the window, e.g. when * maximizing or when changing struts. Configure requests @@ -3937,7 +3922,7 @@ update_net_frame_extents (MetaWindow *window) meta_topic (META_DEBUG_GEOMETRY, "Setting _NET_FRAME_EXTENTS on managed window 0x%lx " - "to left = %ld, right = %ld, top = %ld, bottom = %ld\n", + "to left = %lu, right = %lu, top = %lu, bottom = %lu\n", window->xwindow, data[0], data[1], data[2], data[3]); meta_error_trap_push (window->display); @@ -3964,7 +3949,7 @@ meta_window_set_current_workspace_hint (MetaWindow *window) data[0] = meta_window_get_net_wm_desktop (window); - meta_verbose ("Setting _NET_WM_DESKTOP of %s to %ld\n", + meta_verbose ("Setting _NET_WM_DESKTOP of %s to %lu\n", window->desc, data[0]); meta_error_trap_push (window->display); @@ -4174,7 +4159,7 @@ meta_window_configure_request (MetaWindow *window, else { meta_topic (META_DEBUG_GEOMETRY, - "Not allowing position change for window %s PPosition 0x%lx USPosition 0x%lx type %d\n", + "Not allowing position change for window %s PPosition 0x%lx USPosition 0x%lx type %u\n", window->desc, window->size_hints.flags & PPosition, window->size_hints.flags & USPosition, window->type); @@ -4407,7 +4392,7 @@ meta_window_client_message (MetaWindow *window, if (meta_error_trap_pop_with_return (display, TRUE) != Success) str2 = NULL; - meta_verbose ("Request to change _NET_WM_STATE action %ld atom1: %s atom2: %s\n", + meta_verbose ("Request to change _NET_WM_STATE action %lu atom1: %s atom2: %s\n", action, str1 ? str1 : "(unknown)", str2 ? str2 : "(unknown)"); @@ -5626,7 +5611,7 @@ idle_update_icon (gpointer data) return FALSE; } -void +static void meta_window_unqueue_update_icon (MetaWindow *window) { if (!window->update_icon_queued) @@ -5650,16 +5635,6 @@ meta_window_unqueue_update_icon (MetaWindow *window) } } -void -meta_window_flush_update_icon (MetaWindow *window) -{ - if (window->update_icon_queued) - { - meta_window_unqueue_update_icon (window); - meta_window_update_icon_now (window); - } -} - void meta_window_queue_update_icon (MetaWindow *window) { @@ -5911,7 +5886,7 @@ recalc_window_type (MetaWindow *window) window->wm_state_modal) window->type = META_WINDOW_MODAL_DIALOG; - meta_verbose ("Calculated type %d for %s, old type %d\n", + meta_verbose ("Calculated type %u for %s, old type %u\n", window->type, window->desc, old_type); if (old_type != window->type) @@ -6221,7 +6196,7 @@ menu_callback (MetaWindowMenu *menu, if (window != NULL) /* window can be NULL */ { - meta_verbose ("Menu op %d on %s\n", op, window->desc); + meta_verbose ("Menu op %u on %s\n", op, window->desc); /* op can be 0 for none */ switch (op) diff --git a/src/wm-tester/test-gravity.c b/src/wm-tester/test-gravity.c index 1b6f44116..8e5b581c7 100644 --- a/src/wm-tester/test-gravity.c +++ b/src/wm-tester/test-gravity.c @@ -3,7 +3,7 @@ #include #include -int gravities[10] = { +static int gravities[10] = { NorthWestGravity, NorthGravity, NorthEastGravity, @@ -21,19 +21,19 @@ typedef struct int x, y, width, height; } Rectangle; -Window windows[10]; -int doubled[10] = { 0, }; -Rectangle window_rects[10]; +static Window windows[10]; +static int doubled[10] = { 0, }; +static Rectangle window_rects[10]; #define WINDOW_WIDTH 100 #define WINDOW_HEIGHT 100 -int x_offset[3] = { 0, - WINDOW_WIDTH/2, -WINDOW_WIDTH }; -int y_offset[3] = { 0, - WINDOW_HEIGHT/2, -WINDOW_HEIGHT }; -double screen_x_fraction[3] = { 0, 0.5, 1.0 }; -double screen_y_fraction[3] = { 0, 0.5, 1.0 }; -int screen_width; -int screen_height; +static int x_offset[3] = { 0, - WINDOW_WIDTH/2, -WINDOW_WIDTH }; +static int y_offset[3] = { 0, - WINDOW_HEIGHT/2, -WINDOW_HEIGHT }; +static double screen_x_fraction[3] = { 0, 0.5, 1.0 }; +static double screen_y_fraction[3] = { 0, 0.5, 1.0 }; +static int screen_width; +static int screen_height; static const char* window_gravity_to_string (int gravity) @@ -42,37 +42,26 @@ window_gravity_to_string (int gravity) { case NorthWestGravity: return "NorthWestGravity"; - break; case NorthGravity: return "NorthGravity"; - break; case NorthEastGravity: return "NorthEastGravity"; - break; case WestGravity: return "WestGravity"; - break; case CenterGravity: return "CenterGravity"; - break; case EastGravity: return "EastGravity"; - break; case SouthWestGravity: return "SouthWestGravity"; - break; case SouthGravity: return "SouthGravity"; - break; case SouthEastGravity: return "SouthEastGravity"; - break; case StaticGravity: return "StaticGravity"; - break; default: return "NorthWestGravity"; - break; } } @@ -311,7 +300,9 @@ int main (int argc, char **argv) } } } - - return 0; + + /* This program has an infinite loop above so a return statement would + * just cause compiler warnings. + */ } diff --git a/src/wm-tester/test-resizing.c b/src/wm-tester/test-resizing.c index 479fc69e3..6bf599336 100644 --- a/src/wm-tester/test-resizing.c +++ b/src/wm-tester/test-resizing.c @@ -249,7 +249,9 @@ main (int argc, char **argv) redraw_pending = FALSE; } } - - return 0; + + /* This program has an infinite loop above so a return statement would + * just cause compiler warnings. + */ } diff --git a/src/wm-tester/test-size-hints.c b/src/wm-tester/test-size-hints.c index 1bf551266..72f1b4868 100644 --- a/src/wm-tester/test-size-hints.c +++ b/src/wm-tester/test-size-hints.c @@ -128,7 +128,9 @@ main (int argc, char **argv) redraw_pending = FALSE; } } - - return 0; + + /* This program has an infinite loop above so a return statement would + * just cause compiler warnings. + */ } diff --git a/src/workspace.c b/src/workspace.c index f4a71da13..ce22c1fd7 100644 --- a/src/workspace.c +++ b/src/workspace.c @@ -421,7 +421,7 @@ set_active_space_hint (MetaScreen *screen) data[0] = meta_workspace_index (screen->active_workspace); - meta_verbose ("Setting _NET_CURRENT_DESKTOP to %ld\n", data[0]); + meta_verbose ("Setting _NET_CURRENT_DESKTOP to %lu\n", data[0]); meta_error_trap_push (screen->display); XChangeProperty (screen->display->xdisplay, screen->xroot,