From 3c82397d3fdbbaa8d1614a6f5eeeaad4ef20d3f6 Mon Sep 17 00:00:00 2001 From: Scott Balneaves Date: Tue, 20 Nov 2012 22:50:33 -0600 Subject: Fix deprecations and compile warnings. Clean compile --- src/core/boxes.c | 2 -- src/core/display.c | 4 ++++ src/core/errors.c | 8 +++++++- src/core/keybindings.c | 4 ++++ src/core/main.c | 12 +++++++++++- src/core/prefs.c | 35 ++++++++++++++++++++--------------- src/core/screen.c | 4 ++-- src/core/testasyncgetprop.c | 8 +++++++- src/core/window.c | 14 ++++++++++---- 9 files changed, 65 insertions(+), 26 deletions(-) (limited to 'src/core') diff --git a/src/core/boxes.c b/src/core/boxes.c index dad6b470..877fa458 100644 --- a/src/core/boxes.c +++ b/src/core/boxes.c @@ -311,7 +311,6 @@ meta_rectangle_resize_with_gravity (const MetaRectangle *old_rect, */ /* First, the x direction */ - int adjust = 0; switch (gravity) { case NorthWestGravity: @@ -344,7 +343,6 @@ meta_rectangle_resize_with_gravity (const MetaRectangle *old_rect, rect->width = new_width; /* Next, the y direction */ - adjust = 0; switch (gravity) { case NorthWestGravity: diff --git a/src/core/display.c b/src/core/display.c index eccb5497..a66dfc9f 100644 --- a/src/core/display.c +++ b/src/core/display.c @@ -2805,7 +2805,11 @@ key_event_description (Display *xdisplay, KeySym keysym; const char *str; +#ifdef HAVE_XKB + keysym = XkbKeycodeToKeysym (xdisplay, event->xkey.keycode, 0, 0); +#else keysym = XKeycodeToKeysym (xdisplay, event->xkey.keycode, 0); +#endif str = XKeysymToString (keysym); diff --git a/src/core/errors.c b/src/core/errors.c index 6539d7b1..c603ccfd 100644 --- a/src/core/errors.c +++ b/src/core/errors.c @@ -29,6 +29,12 @@ #include #include +#ifdef __GNUC__ +#define UNUSED_VARIABLE __attribute__ ((unused)) +#else +#define UNUSED_VARIABLE +#endif + static int x_error_handler (Display *display, XErrorEvent *error); static int x_io_error_handler (Display *display); @@ -121,7 +127,7 @@ meta_error_trap_pop_internal (MetaDisplay *display, * assumes that there are no pending GDK traps from GDK itself */ - int (* restored_error_handler) (Display *, + int UNUSED_VARIABLE (* restored_error_handler) (Display *, XErrorEvent *); restored_error_handler = XSetErrorHandler (x_error_handler); diff --git a/src/core/keybindings.c b/src/core/keybindings.c index 8dda13cd..07384b22 100644 --- a/src/core/keybindings.c +++ b/src/core/keybindings.c @@ -1273,7 +1273,11 @@ meta_display_process_key_event (MetaDisplay *display, /* window may be NULL */ +#ifdef HAVE_XKB + keysym = XkbKeycodeToKeysym (display->xdisplay, event->xkey.keycode, 0, 0); +#else keysym = XKeycodeToKeysym (display->xdisplay, event->xkey.keycode, 0); +#endif str = XKeysymToString (keysym); diff --git a/src/core/main.c b/src/core/main.c index 90332c50..5f8d9b32 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -69,6 +69,12 @@ #include #include +#ifdef __GNUC__ +#define UNUSED_VARIABLE __attribute__ ((unused)) +#else +#define UNUSED_VARIABLE +#endif + /** * The exit code we'll return to our parent process when we eventually die. */ @@ -376,7 +382,7 @@ sigterm_handler (int signum) { if (sigterm_pipe_fds[1] >= 0) { - int dummy; + int UNUSED_VARIABLE dummy; dummy = write (sigterm_pipe_fds[1], "", 1); close (sigterm_pipe_fds[1]); @@ -415,8 +421,12 @@ main (int argc, char **argv) guint i; GIOChannel *channel; +#if GLIB_CHECK_VERSION (2, 32, 0) + /* g_thread_init () deprecated */ +#else if (!g_thread_supported ()) g_thread_init (NULL); +#endif if (setlocale (LC_ALL, "") == NULL) meta_warning ("Locale not understood by C library, internationalization will not work\n"); diff --git a/src/core/prefs.c b/src/core/prefs.c index a39af335..a2cd3d76 100644 --- a/src/core/prefs.c +++ b/src/core/prefs.c @@ -143,7 +143,10 @@ static char* settings_key_for_workspace_name (int i); static void queue_changed (MetaPreference pref); +#if 0 static void cleanup_error (GError **error); +#endif + static void maybe_give_disable_workarounds_warning (void); static void titlebar_handler (MetaPreference, const gchar*, gboolean*); @@ -275,37 +278,37 @@ static MetaEnumPreference preferences_enum[] = { "focus-new-windows", KEY_GENERAL_SCHEMA, META_PREF_FOCUS_NEW_WINDOWS, - &focus_new_windows, + (gint *) &focus_new_windows, }, { "focus-mode", KEY_GENERAL_SCHEMA, META_PREF_FOCUS_MODE, - &focus_mode, + (gint *) &focus_mode, }, { "wrap-style", KEY_GENERAL_SCHEMA, META_PREF_WRAP_STYLE, - &wrap_style, + (gint *) &wrap_style, }, { "visual-bell-type", KEY_GENERAL_SCHEMA, META_PREF_VISUAL_BELL_TYPE, - &visual_bell_type, + (gint *) &visual_bell_type, }, { "action-double-click-titlebar", KEY_GENERAL_SCHEMA, META_PREF_ACTION_DOUBLE_CLICK_TITLEBAR, - &action_double_click_titlebar, + (gint *) &action_double_click_titlebar, }, { "action-middle-click-titlebar", KEY_GENERAL_SCHEMA, META_PREF_ACTION_MIDDLE_CLICK_TITLEBAR, - &action_middle_click_titlebar, + (gint *) &action_middle_click_titlebar, }, { "action-right-click-titlebar", KEY_GENERAL_SCHEMA, META_PREF_ACTION_RIGHT_CLICK_TITLEBAR, - &action_right_click_titlebar, + (gint *) &action_right_click_titlebar, }, { NULL, NULL, 0, NULL }, }; @@ -898,7 +901,7 @@ meta_prefs_init (void) /* Updates. */ /****************************************************************************/ -gboolean (*preference_update_handler[]) (const gchar*, GVariant*) = { +gboolean (*preference_update_handler[]) (const gchar*, GSettings*) = { handle_preference_update_enum, handle_preference_update_bool, handle_preference_update_string, @@ -975,6 +978,7 @@ change_notify (GSettings *settings, g_free (schema_name); } +#if 0 static void cleanup_error (GError **error) { @@ -986,6 +990,7 @@ cleanup_error (GError **error) *error = NULL; } } +#endif /** * Special case: give a warning the first time disable_workarounds @@ -1566,9 +1571,9 @@ init_bindings (void) NULL }; int i; - gchar **list; - gchar *str_val; - GSettings *bindings_settings; + gchar **list = NULL; + gchar *str_val = NULL; + GSettings *bindings_settings = NULL; for (i = 0; prefix[i]; i++) { @@ -1589,8 +1594,8 @@ init_bindings (void) static void init_commands (void) { - gchar **list; - gchar *str_val; + gchar **list = NULL; + gchar *str_val = NULL; list = g_settings_list_keys (settings_command); while (*list != NULL) @@ -1605,8 +1610,8 @@ init_commands (void) static void init_workspace_names (void) { - gchar **list; - gchar *str_val; + gchar **list = NULL; + gchar *str_val = NULL; list = g_settings_list_keys (settings_workspace_names); while (*list != NULL) diff --git a/src/core/screen.c b/src/core/screen.c index f696d92a..e8fce40a 100644 --- a/src/core/screen.c +++ b/src/core/screen.c @@ -1272,8 +1272,8 @@ meta_screen_ensure_tab_popup (MetaScreen *screen, { MetaWindow *window; MetaRectangle r; - GdkPixbuf *win_pixbuf; - int width, height; + GdkPixbuf *win_pixbuf = NULL; + int width = 0, height = 0; window = tmp->data; diff --git a/src/core/testasyncgetprop.c b/src/core/testasyncgetprop.c index ed044009..25490cb8 100644 --- a/src/core/testasyncgetprop.c +++ b/src/core/testasyncgetprop.c @@ -81,6 +81,12 @@ print_backtrace (void) } #endif +#ifdef __GNUC__ +#define UNUSED_VARIABLE __attribute__ ((unused)) +#else +#define UNUSED_VARIABLE +#endif + static int error_trap_depth = 0; static int @@ -416,7 +422,7 @@ run_speed_comparison (Display *xdisplay, while ((task = ag_get_next_completed_task (xdisplay))) { - int result; + int UNUSED_VARIABLE result; Atom actual_type; int actual_format; unsigned long n_items; diff --git a/src/core/window.c b/src/core/window.c index 06b6446f..bf1b53e4 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -53,6 +53,12 @@ #include #endif +#ifdef __GNUC__ +#define UNUSED_VARIABLE __attribute__ ((unused)) +#else +#define UNUSED_VARIABLE +#endif + static int destroying_windows_disallowed = 0; @@ -5204,7 +5210,7 @@ meta_window_client_message (MetaWindow *window, else if (event->xclient.message_type == display->atom__NET_MOVERESIZE_WINDOW) { - int gravity, source; + int gravity, UNUSED_VARIABLE source; guint value_mask; gravity = (event->xclient.data.l[0] & 0xff); @@ -5252,7 +5258,7 @@ meta_window_client_message (MetaWindow *window, else if (event->xclient.message_type == display->atom__NET_WM_FULLSCREEN_MONITORS) { - MetaClientType source_indication; + MetaClientType UNUSED_VARIABLE source_indication; gulong top, bottom, left, right; meta_verbose ("_NET_WM_FULLSCREEN_MONITORS request for window '%s'\n", @@ -5463,7 +5469,7 @@ static gboolean process_property_notify (MetaWindow *window, XPropertyEvent *event) { - Window xid = window->xwindow; + Window UNUSED_VARIABLE xid = window->xwindow; if (meta_is_verbose ()) /* avoid looking up the name if we don't have to */ { @@ -6705,7 +6711,7 @@ meta_window_titlebar_is_onscreen (MetaWindow *window) { MetaRectangle titlebar_rect; GList *onscreen_region; - int titlebar_size; + int UNUSED_VARIABLE titlebar_size; gboolean is_onscreen; const int min_height_needed = 8; -- cgit v1.2.1