summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Thurman <tthurman@gnome.org>2008-02-27 04:39:10 +0000
committerThomas James Alexander Thurman <tthurman@src.gnome.org>2008-02-27 04:39:10 +0000
commit85631aec0f6b76f9e08afd12123555e07757397e (patch)
tree731dee6e4e4db0913a80d7dd3b8662d9439791f7
parent401b716cf5143fa69603c1b20f95f3745b1046ed (diff)
downloadmetacity-85631aec0f6b76f9e08afd12123555e07757397e.tar.gz
metacity-85631aec0f6b76f9e08afd12123555e07757397e.tar.bz2
Lots of tiny fixes to make sure we compile with "gcc -ansi -Werror".
2008-02-27 Thomas Thurman <tthurman@gnome.org> Lots of tiny fixes to make sure we compile with "gcc -ansi -Werror". svn path=/trunk/; revision=3606
-rw-r--r--ChangeLog5
-rw-r--r--src/core/boxes.c5
-rw-r--r--src/core/compositor.c5
-rw-r--r--src/core/constraints.c4
-rw-r--r--src/core/delete.c3
-rw-r--r--src/core/keybindings.c3
-rw-r--r--src/core/main.c5
-rw-r--r--src/core/place.c6
-rw-r--r--src/core/testboxes.c18
-rw-r--r--src/core/util.c3
-rw-r--r--src/core/window-props.c3
-rw-r--r--src/core/window.c25
-rw-r--r--src/tools/metacity-mag.c3
-rw-r--r--src/ui/preview-widget.c6
14 files changed, 65 insertions, 29 deletions
diff --git a/ChangeLog b/ChangeLog
index 9e5e858..ee49765 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-02-27 Thomas Thurman <tthurman@gnome.org>
+
+ Lots of tiny fixes to make sure we compile with
+ "gcc -ansi -Werror".
+
2008-02-26 Jens Granseuer <jensgr@gmx.net>
* src/core/constraints.c (constrain_aspect_ratio,
diff --git a/src/core/boxes.c b/src/core/boxes.c
index c7bf8cd..21a9e2b 100644
--- a/src/core/boxes.c
+++ b/src/core/boxes.c
@@ -29,7 +29,6 @@
#include "boxes.h"
#include "util.h"
#include <X11/Xutil.h> /* Just for the definition of the various gravities */
-#include <stdio.h> /* For snprintf */
char*
meta_rectangle_to_string (const MetaRectangle *rect,
@@ -61,7 +60,7 @@ meta_rectangle_region_to_string (GList *region,
char *cur = output;
if (region == NULL)
- snprintf (output, 10, "(EMPTY)");
+ g_snprintf (output, 10, "(EMPTY)");
while (tmp)
{
@@ -114,7 +113,7 @@ meta_rectangle_edge_list_to_string (GList *edge_list,
GList *tmp = edge_list;
if (edge_list == NULL)
- snprintf (output, 10, "(EMPTY)");
+ g_snprintf (output, 10, "(EMPTY)");
while (tmp)
{
diff --git a/src/core/compositor.c b/src/core/compositor.c
index 79d1206..1612cf5 100644
--- a/src/core/compositor.c
+++ b/src/core/compositor.c
@@ -21,6 +21,9 @@
* 02111-1307, USA.
*/
+#define _GNU_SOURCE
+#define _XOPEN_SOURCE 500 /* for usleep() */
+
#include <config.h>
#include <stdlib.h>
@@ -1310,7 +1313,7 @@ add_damage (MetaScreen *screen,
MetaDisplay *display = screen->display;
MetaCompScreen *info = screen->compositor_data;
-// dump_xserver_region ("add_damage", display, damage);
+ /* dump_xserver_region ("add_damage", display, damage); */
if (info->all_damage)
{
diff --git a/src/core/constraints.c b/src/core/constraints.c
index c11d390..54dc794 100644
--- a/src/core/constraints.c
+++ b/src/core/constraints.c
@@ -91,7 +91,7 @@
typedef enum
{
- PRIORITY_MINIMUM = 0, // Dummy value used for loop start = min(all priorities)
+ PRIORITY_MINIMUM = 0, /* Dummy value used for loop start = min(all priorities) */
PRIORITY_ASPECT_RATIO = 0,
PRIORITY_ENTIRELY_VISIBLE_ON_SINGLE_XINERAMA = 0,
PRIORITY_ENTIRELY_VISIBLE_ON_WORKAREA = 1,
@@ -101,7 +101,7 @@ typedef enum
PRIORITY_SIZE_HINTS_LIMITS = 3,
PRIORITY_TITLEBAR_VISIBLE = 4,
PRIORITY_PARTIALLY_VISIBLE_ON_WORKAREA = 4,
- PRIORITY_MAXIMUM = 4 // Dummy value used for loop end = max(all priorities)
+ PRIORITY_MAXIMUM = 4 /* Dummy value used for loop end = max(all priorities) */
} ConstraintPriority;
typedef enum
diff --git a/src/core/delete.c b/src/core/delete.c
index 01bfd02..cc9ebc8 100644
--- a/src/core/delete.c
+++ b/src/core/delete.c
@@ -22,6 +22,9 @@
* 02111-1307, USA.
*/
+#define _GNU_SOURCE
+#define _SVID_SOURCE /* for gethostname() */
+
#include <config.h>
#include "util.h"
#include "window.h"
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
index 6b39ac1..9f75622 100644
--- a/src/core/keybindings.c
+++ b/src/core/keybindings.c
@@ -23,6 +23,9 @@
* 02111-1307, USA.
*/
+#define _GNU_SOURCE
+#define _SVID_SOURCE /* for putenv() */
+
#include <config.h>
#include "keybindings.h"
#include "workspace.h"
diff --git a/src/core/main.c b/src/core/main.c
index ac8afec..0c10a62 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -40,6 +40,9 @@
* to investigate, read main(), meta_display_open(), and event_callback().
*/
+#define _GNU_SOURCE
+#define _SVID_SOURCE /* for putenv() and some signal-related functions */
+
#include <config.h>
#include "main.h"
#include "util.h"
@@ -331,7 +334,7 @@ main (int argc, char **argv)
NULL, G_LOG_DOMAIN, "Gtk", "Gdk", "GLib",
"Pango", "GLib-GObject", "GThread"
};
- gint i;
+ guint i;
if (setlocale (LC_ALL, "") == NULL)
meta_warning ("Locale not understood by C library, internationalization will not work\n");
diff --git a/src/core/place.c b/src/core/place.c
index 20972a3..c92edd1 100644
--- a/src/core/place.c
+++ b/src/core/place.c
@@ -41,6 +41,7 @@ typedef enum
META_BOTTOM
} MetaWindowDirection;
+#if 0 /* never used -- remove if nobody wants it */
static gint
northwestcmp (gconstpointer a, gconstpointer b)
{
@@ -86,7 +87,9 @@ northwestcmp (gconstpointer a, gconstpointer b)
else
return 0;
}
-
+#endif /* 0 -- never used */
+
+#if 0 /* never used -- remove if nobody wants it */
static void
find_next_cascade (MetaWindow *window,
MetaFrameGeometry *fgeom,
@@ -234,6 +237,7 @@ find_next_cascade (MetaWindow *window,
*new_y = cascade_y + fgeom->top_height;
}
}
+#endif /* 0 -- never used */
static void
find_most_freespace (MetaWindow *window,
diff --git a/src/core/testboxes.c b/src/core/testboxes.c
index 0da2975..91ac2f8 100644
--- a/src/core/testboxes.c
+++ b/src/core/testboxes.c
@@ -625,15 +625,15 @@ test_regions_okay ()
/*************************************************************/
region = get_screen_region (3);
tmp = NULL;
- tmp = g_list_prepend (tmp, new_meta_rect ( 380, 675, 420, 525)); // 220500
- tmp = g_list_prepend (tmp, new_meta_rect ( 0, 20, 300, 1180)); // 354000
- tmp = g_list_prepend (tmp, new_meta_rect ( 380, 20, 320, 1180)); // 377600
- tmp = g_list_prepend (tmp, new_meta_rect ( 0, 675, 800, 475)); // 380000
- tmp = g_list_prepend (tmp, new_meta_rect (1200, 20, 400, 1180)); // 472000
- tmp = g_list_prepend (tmp, new_meta_rect ( 0, 675, 1600, 425)); // 680000
- tmp = g_list_prepend (tmp, new_meta_rect ( 900, 20, 700, 1080)); // 756000
- tmp = g_list_prepend (tmp, new_meta_rect ( 0, 20, 700, 1130)); // 791000
- tmp = g_list_prepend (tmp, new_meta_rect ( 0, 20, 1600, 505)); // 808000
+ tmp = g_list_prepend (tmp, new_meta_rect ( 380, 675, 420, 525)); /* 220500 */
+ tmp = g_list_prepend (tmp, new_meta_rect ( 0, 20, 300, 1180)); /* 354000 */
+ tmp = g_list_prepend (tmp, new_meta_rect ( 380, 20, 320, 1180)); /* 377600 */
+ tmp = g_list_prepend (tmp, new_meta_rect ( 0, 675, 800, 475)); /* 380000 */
+ tmp = g_list_prepend (tmp, new_meta_rect (1200, 20, 400, 1180)); /* 472000 */
+ tmp = g_list_prepend (tmp, new_meta_rect ( 0, 675, 1600, 425)); /* 680000 */
+ tmp = g_list_prepend (tmp, new_meta_rect ( 900, 20, 700, 1080)); /* 756000 */
+ tmp = g_list_prepend (tmp, new_meta_rect ( 0, 20, 700, 1130)); /* 791000 */
+ tmp = g_list_prepend (tmp, new_meta_rect ( 0, 20, 1600, 505)); /* 808000 */
#if 0
printf ("Got to here...\n");
char region_list[(RECT_LENGTH+2) * g_list_length (region)];
diff --git a/src/core/util.c b/src/core/util.c
index 600240b..e0da863 100644
--- a/src/core/util.c
+++ b/src/core/util.c
@@ -22,6 +22,9 @@
* 02111-1307, USA.
*/
+#define _GNU_SOURCE
+#define _POSIX_C_SOURCE /* for fdopen() */
+
#include <config.h>
#include "util.h"
#include "main.h"
diff --git a/src/core/window-props.c b/src/core/window-props.c
index 48c5371..fb95245 100644
--- a/src/core/window-props.c
+++ b/src/core/window-props.c
@@ -22,6 +22,9 @@
* 02111-1307, USA.
*/
+#define _GNU_SOURCE
+#define _SVID_SOURCE /* for gethostname() */
+
#include <config.h>
#include "window-props.h"
#include "errors.h"
diff --git a/src/core/window.c b/src/core/window.c
index 49b1913..ebf3e09 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -627,17 +627,20 @@ meta_window_new_with_attrs (MetaDisplay *display,
parent = meta_display_lookup_x_window (window->display,
window->xtransient_for);
- // First, maybe the app was launched with startup notification using an
- // obsolete version of the spec; use that timestamp if it exists.
+ /* First, maybe the app was launched with startup notification using an
+ * obsolete version of the spec; use that timestamp if it exists.
+ */
if (window->initial_timestamp_set)
- // NOTE: Do NOT toggle net_wm_user_time_set to true; this is just
- // being recorded as a fallback for potential transients
+ /* NOTE: Do NOT toggle net_wm_user_time_set to true; this is just
+ * being recorded as a fallback for potential transients
+ */
window->net_wm_user_time = window->initial_timestamp;
else if (parent != NULL)
meta_window_set_user_time(window, parent->net_wm_user_time);
else
- // NOTE: Do NOT toggle net_wm_user_time_set to true; this is just
- // being recorded as a fallback for potential transients
+ /* NOTE: Do NOT toggle net_wm_user_time_set to true; this is just
+ * being recorded as a fallback for potential transients
+ */
window->net_wm_user_time =
meta_display_get_current_time_roundtrip (window->display);
}
@@ -5085,10 +5088,10 @@ meta_window_client_message (MetaWindow *window,
meta_window_move_resize_request(window,
value_mask,
gravity,
- event->xclient.data.l[1], // x
- event->xclient.data.l[2], // y
- event->xclient.data.l[3], // width
- event->xclient.data.l[4]); // height
+ event->xclient.data.l[1], /* x */
+ event->xclient.data.l[2], /* y */
+ event->xclient.data.l[3], /* width */
+ event->xclient.data.l[4]); /* height */
}
else if (event->xclient.message_type ==
display->atom_net_active_window)
@@ -5892,7 +5895,7 @@ meta_window_update_struts (MetaWindow *window)
strut_end = struts[4+(i*2)+1];
temp = g_new (MetaStrut, 1);
- temp->side = 1 << i; // See MetaDirection def. Matches nicely, eh?
+ temp->side = 1 << i; /* See MetaDirection def. Matches nicely, eh? */
temp->rect = window->screen->rect;
switch (temp->side)
{
diff --git a/src/tools/metacity-mag.c b/src/tools/metacity-mag.c
index 9549896..55da73c 100644
--- a/src/tools/metacity-mag.c
+++ b/src/tools/metacity-mag.c
@@ -19,6 +19,9 @@
* 02111-1307, USA.
*/
+#define _GNU_SOURCE
+#define _XOPEN_SOURCE 600 /* C99 -- for rint() */
+
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
#include <gdk/gdkkeysyms.h>
diff --git a/src/ui/preview-widget.c b/src/ui/preview-widget.c
index 57bb8b3..c0ac6d7 100644
--- a/src/ui/preview-widget.c
+++ b/src/ui/preview-widget.c
@@ -21,6 +21,10 @@
* 02111-1307, USA.
*/
+#define _GNU_SOURCE
+#define _XOPEN_SOURCE 600 /* for the maths routines over floats */
+
+#include <math.h>
#include "preview-widget.h"
static void meta_preview_class_init (MetaPreviewClass *klass);
@@ -470,7 +474,7 @@ meta_preview_get_clip_region (MetaPreview *preview, gint new_window_width, gint
MetaFrameLayout *fgeom;
MetaFrameStyle *frame_style;
- g_return_if_fail (META_IS_PREVIEW (preview));
+ g_return_val_if_fail (META_IS_PREVIEW (preview), NULL);
flags = (META_PREVIEW (preview)->flags);