Avoid shadowing existing variables

This commit is contained in:
Florian Müllner 2015-09-24 01:24:33 +02:00
parent 5801b5518f
commit bc00f118f3
12 changed files with 41 additions and 57 deletions

View File

@ -523,15 +523,13 @@ update_trackball_scroll_button (MetaInputSettings *input_settings,
} }
else if (!device) else if (!device)
{ {
MetaInputSettingsPrivate *priv;
const GSList *devices; const GSList *devices;
priv = meta_input_settings_get_instance_private (input_settings);
devices = clutter_device_manager_peek_devices (priv->device_manager); devices = clutter_device_manager_peek_devices (priv->device_manager);
while (devices) while (devices)
{ {
ClutterInputDevice *device = devices->data; device = devices->data;
if (device_is_trackball (device)) if (device_is_trackball (device))
input_settings_class->set_scroll_button (input_settings, device, button); input_settings_class->set_scroll_button (input_settings, device, button);

View File

@ -1846,7 +1846,7 @@ crtc_assignment_assign (CrtcAssignment *assign,
} }
else else
{ {
MetaCRTCInfo *info = g_slice_new0 (MetaCRTCInfo); info = g_slice_new0 (MetaCRTCInfo);
info->crtc = crtc; info->crtc = crtc;
info->mode = mode; info->mode = mode;

View File

@ -197,7 +197,7 @@ meta_monitor_manager_dummy_apply_config (MetaMonitorManager *manager,
{ {
MetaMonitorMode *mode; MetaMonitorMode *mode;
MetaOutput *output; MetaOutput *output;
int i, n_outputs; unsigned int j;
int width, height; int width, height;
mode = crtc_info->mode; mode = crtc_info->mode;
@ -223,10 +223,9 @@ meta_monitor_manager_dummy_apply_config (MetaMonitorManager *manager,
screen_width = MAX (screen_width, crtc_info->x + width); screen_width = MAX (screen_width, crtc_info->x + width);
screen_height = MAX (screen_height, crtc_info->y + height); screen_height = MAX (screen_height, crtc_info->y + height);
n_outputs = crtc_info->outputs->len; for (j = 0; j < crtc_info->outputs->len; j++)
for (i = 0; i < n_outputs; i++)
{ {
output = ((MetaOutput**)crtc_info->outputs->pdata)[i]; output = ((MetaOutput**)crtc_info->outputs->pdata)[j];
output->is_dirty = TRUE; output->is_dirty = TRUE;
output->crtc = crtc; output->crtc = crtc;

View File

@ -112,12 +112,12 @@ get_seat_proxy (GCancellable *cancellable)
static void static void
session_unpause (void) session_unpause (void)
{ {
ClutterBackend *backend; ClutterBackend *clutter_backend;
CoglContext *cogl_context; CoglContext *cogl_context;
CoglDisplay *cogl_display; CoglDisplay *cogl_display;
backend = clutter_get_default_backend (); clutter_backend = clutter_get_default_backend ();
cogl_context = clutter_backend_get_cogl_context (backend); cogl_context = clutter_backend_get_cogl_context (clutter_backend);
cogl_display = cogl_context_get_display (cogl_context); cogl_display = cogl_context_get_display (cogl_context);
cogl_kms_display_queue_modes_reset (cogl_display); cogl_kms_display_queue_modes_reset (cogl_display);

View File

@ -441,6 +441,7 @@ meta_backend_x11_post_init (MetaBackend *backend)
MetaBackendX11 *x11 = META_BACKEND_X11 (backend); MetaBackendX11 *x11 = META_BACKEND_X11 (backend);
MetaBackendX11Private *priv = meta_backend_x11_get_instance_private (x11); MetaBackendX11Private *priv = meta_backend_x11_get_instance_private (x11);
int major, minor; int major, minor;
gboolean has_xi = FALSE;
priv->xdisplay = clutter_x11_get_default_display (); priv->xdisplay = clutter_x11_get_default_display ();
@ -450,27 +451,23 @@ meta_backend_x11_post_init (MetaBackend *backend)
!XSyncInitialize (priv->xdisplay, &major, &minor)) !XSyncInitialize (priv->xdisplay, &major, &minor))
meta_fatal ("Could not initialize XSync"); meta_fatal ("Could not initialize XSync");
{ if (XQueryExtension (priv->xdisplay,
int major = 2, minor = 3; "XInputExtension",
gboolean has_xi = FALSE; &priv->xinput_opcode,
&priv->xinput_error_base,
&priv->xinput_event_base))
{
major = 2; minor = 3;
if (XIQueryVersion (priv->xdisplay, &major, &minor) == Success)
{
int version = (major * 10) + minor;
if (version >= 22)
has_xi = TRUE;
}
}
if (XQueryExtension (priv->xdisplay, if (!has_xi)
"XInputExtension", meta_fatal ("X server doesn't have the XInput extension, version 2.2 or newer\n");
&priv->xinput_opcode,
&priv->xinput_error_base,
&priv->xinput_event_base))
{
if (XIQueryVersion (priv->xdisplay, &major, &minor) == Success)
{
int version = (major * 10) + minor;
if (version >= 22)
has_xi = TRUE;
}
}
if (!has_xi)
meta_fatal ("X server doesn't have the XInput extension, version 2.2 or newer\n");
}
/* We only take the passive touch grab if we are a X11 compositor */ /* We only take the passive touch grab if we are a X11 compositor */
if (priv->mode == META_BACKEND_X11_MODE_COMPOSITOR) if (priv->mode == META_BACKEND_X11_MODE_COMPOSITOR)
@ -795,8 +792,6 @@ meta_backend_x11_update_screen_size (MetaBackend *backend,
} }
else else
{ {
MetaBackendX11 *x11 = META_BACKEND_X11 (backend);
MetaBackendX11Private *priv = meta_backend_x11_get_instance_private (x11);
Window xwin = meta_backend_x11_get_xwindow (x11); Window xwin = meta_backend_x11_get_xwindow (x11);
XResizeWindow (priv->xdisplay, xwin, width, height); XResizeWindow (priv->xdisplay, xwin, width, height);
} }

View File

@ -1133,17 +1133,16 @@ meta_monitor_manager_xrandr_apply_configuration (MetaMonitorManager *manager,
if (crtc_info->mode != NULL) if (crtc_info->mode != NULL)
{ {
MetaMonitorMode *mode; MetaMonitorMode *mode;
g_autofree XID *outputs = NULL; g_autofree XID *output_ids = NULL;
unsigned int j, n_outputs; unsigned int j, n_output_ids;
int width, height;
Status ok; Status ok;
mode = crtc_info->mode; mode = crtc_info->mode;
n_outputs = crtc_info->outputs->len; n_output_ids = crtc_info->outputs->len;
outputs = g_new (XID, n_outputs); output_ids = g_new (XID, n_output_ids);
for (j = 0; j < n_outputs; j++) for (j = 0; j < n_output_ids; j++)
{ {
MetaOutput *output; MetaOutput *output;
@ -1152,7 +1151,7 @@ meta_monitor_manager_xrandr_apply_configuration (MetaMonitorManager *manager,
output->is_dirty = TRUE; output->is_dirty = TRUE;
output->crtc = crtc; output->crtc = crtc;
outputs[j] = output->winsys_id; output_ids[j] = output->winsys_id;
} }
ok = XRRSetCrtcConfig (manager_xrandr->xdisplay, ok = XRRSetCrtcConfig (manager_xrandr->xdisplay,
@ -1162,7 +1161,7 @@ meta_monitor_manager_xrandr_apply_configuration (MetaMonitorManager *manager,
crtc_info->x, crtc_info->y, crtc_info->x, crtc_info->y,
(XID)mode->mode_id, (XID)mode->mode_id,
meta_monitor_transform_to_xrandr (crtc_info->transform), meta_monitor_transform_to_xrandr (crtc_info->transform),
outputs, n_outputs); output_ids, n_output_ids);
if (ok != Success) if (ok != Success)
{ {

View File

@ -607,12 +607,11 @@ meta_display_open (void)
meta_verbose ("Creating %d atoms\n", (int) G_N_ELEMENTS (atom_names)); meta_verbose ("Creating %d atoms\n", (int) G_N_ELEMENTS (atom_names));
XInternAtoms (display->xdisplay, (char **)atom_names, G_N_ELEMENTS (atom_names), XInternAtoms (display->xdisplay, (char **)atom_names, G_N_ELEMENTS (atom_names),
False, atoms); False, atoms);
{
int i = 0; i = 0;
#define item(x) display->atom_##x = atoms[i++]; #define item(x) display->atom_##x = atoms[i++];
#include <x11/atomnames.h> #include <x11/atomnames.h>
#undef item #undef item
}
display->prop_hooks = NULL; display->prop_hooks = NULL;
meta_display_init_window_prop_hooks (display); meta_display_init_window_prop_hooks (display);

View File

@ -206,8 +206,8 @@ meta_display_handle_event (MetaDisplay *display,
if (meta_is_wayland_compositor () && event->type == CLUTTER_MOTION) if (meta_is_wayland_compositor () && event->type == CLUTTER_MOTION)
{ {
MetaCursorTracker *tracker = meta_cursor_tracker_get_for_screen (NULL); meta_cursor_tracker_update_position (meta_cursor_tracker_get_for_screen (NULL),
meta_cursor_tracker_update_position (tracker, event->motion.x, event->motion.y); event->motion.x, event->motion.y);
display->monitor_cache_invalidated = TRUE; display->monitor_cache_invalidated = TRUE;
} }

View File

@ -1088,11 +1088,7 @@ stack_sync_to_xserver (MetaStack *stack)
if (w->hidden) if (w->hidden)
{ {
if (w->client_type == META_WINDOW_CLIENT_TYPE_X11) if (w->client_type == META_WINDOW_CLIENT_TYPE_X11)
{ g_array_append_val (x11_hidden_stack_ids, top_level_window);
guint64 stack_id = top_level_window;
g_array_append_val (x11_hidden_stack_ids, stack_id);
}
continue; continue;
} }

View File

@ -4312,8 +4312,8 @@ set_workspace_state (MetaWindow *window,
GList *l; GList *l;
for (l = window->screen->workspaces; l != NULL; l = l->next) for (l = window->screen->workspaces; l != NULL; l = l->next)
{ {
MetaWorkspace *workspace = l->data; MetaWorkspace *ws = l->data;
meta_workspace_remove_window (workspace, window); meta_workspace_remove_window (ws, window);
} }
} }
@ -4327,8 +4327,8 @@ set_workspace_state (MetaWindow *window,
GList *l; GList *l;
for (l = window->screen->workspaces; l != NULL; l = l->next) for (l = window->screen->workspaces; l != NULL; l = l->next)
{ {
MetaWorkspace *workspace = l->data; MetaWorkspace *ws = l->data;
meta_workspace_add_window (workspace, window); meta_workspace_add_window (ws, window);
} }
} }

View File

@ -1094,7 +1094,6 @@ main (int argc, char **argv)
if (all_tests) if (all_tests)
{ {
GFile *test_dir = g_file_new_for_path (MUTTER_PKGDATADIR "/tests"); GFile *test_dir = g_file_new_for_path (MUTTER_PKGDATADIR "/tests");
GError *error = NULL;
if (!find_metatests_in_directory (test_dir, tests, &error)) if (!find_metatests_in_directory (test_dir, tests, &error))
{ {

View File

@ -160,7 +160,6 @@ xdnd_send_enter (MetaXWaylandSelection *selection_data,
if (source_mime_types->size <= 3) if (source_mime_types->size <= 3)
{ {
/* The mimetype atoms fit in this same message */ /* The mimetype atoms fit in this same message */
gchar **p;
gint i = 2; gint i = 2;
wl_array_for_each (p, source_mime_types) wl_array_for_each (p, source_mime_types)