Commit 32d4bd6b authored by Elijah Newren's avatar Elijah Newren Committed by Elijah Newren
Browse files

Patch from Kjartan Maraas to fix a lot of tiny issues (unused variable

2006-01-20  Elijah Newren  <newren gmail com>

	* 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
parent 4c107222
2006-01-20 Elijah Newren <newren gmail com>
* 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 <newren gmail com>
Patch from Björn Lindqvist to fix #98340.
......
......@@ -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)
......
......@@ -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);
}
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);
{
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);
}
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 "
......
......@@ -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)
......
......@@ -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;
......
......@@ -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));
......
......@@ -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 */
......
......@@ -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)
......
......@@ -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;
......
......@@ -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 ())
......
......@@ -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)";
......
......@@ -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);
}
......
......@@ -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,
......
......@@ -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*
......
......@@ -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",