summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary Wong <gtw@gnu.org>2009-08-31 20:15:07 -0600
committerGary Wong <gtw@gnu.org>2009-08-31 20:15:07 -0600
commitcf1b6f1e83b798ad54bdf6147dc3557220d7312a (patch)
tree4781a548f8499ce12d83a988801f27d9ef02d1a8
parent6d9d33354b9ac4ef25708d13e385c0c24a1fa2f3 (diff)
Declare various read-only data structures as const.
-rw-r--r--ChangeLog8
-rw-r--r--button.c2
-rw-r--r--button.h2
-rw-r--r--frame.c4
-rw-r--r--frame.h2
-rw-r--r--gwm.c24
-rw-r--r--managed.c2
-rw-r--r--managed.h2
-rw-r--r--root.c2
-rw-r--r--root.h2
10 files changed, 28 insertions, 22 deletions
diff --git a/ChangeLog b/ChangeLog
index 53c1d79..8e1981a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,15 @@
2009-08-31 Gary Wong <gtw@gnu.org>
+ * gwm.c (show_atom): Declare predefined_names[] as const.
+ (show_error): Declare render_strings[] as const.
+ (show_event): Declare event_names[] as const.
+ (setup_display): Use auto storage class for wm_atom_str.
+
+2009-08-31 Gary Wong <gtw@gnu.org>
+
* gwm.c (start_managing_window): Create "border region" input-only
windows, to allow setting different cursors on various border parts.
+
* frame.c (frame_configure_notify): Update the geometry of the
border regions.
* decorate-core.c (decorate_core_init): Cursor indices were rearranged.
diff --git a/button.c b/button.c
index 4bd2617..7abcc96 100644
--- a/button.c
+++ b/button.c
@@ -139,7 +139,7 @@ static void button_leave_notify( struct gwm_window *window,
set_button_active( window, FALSE );
}
-event_handler button_handlers[] = {
+const event_handler button_handlers[] = {
NULL, /* Error */
NULL, /* Reply */
NULL, /* KeyPress */
diff --git a/button.h b/button.h
index 03a7505..9a2fbc0 100644
--- a/button.h
+++ b/button.h
@@ -4,6 +4,6 @@
extern int button_size( struct gwm_window *window, int include_x_border );
extern int button_xb( struct gwm_window *window );
-extern event_handler button_handlers[];
+extern const event_handler button_handlers[];
#endif
diff --git a/frame.c b/frame.c
index 41d5714..e750211 100644
--- a/frame.c
+++ b/frame.c
@@ -1111,7 +1111,7 @@ static void frame_configure_request( struct gwm_window *window,
synthetic_configure_notify( window );
}
-event_handler frame_handlers[] = {
+const event_handler frame_handlers[] = {
NULL, /* Error */
NULL, /* Reply */
NULL, /* KeyPress */
@@ -1151,7 +1151,7 @@ event_handler frame_handlers[] = {
NULL /* ShapeNotify */
};
-event_handler childless_handlers[] = {
+const event_handler childless_handlers[] = {
NULL, /* Error */
NULL, /* Reply */
NULL, /* KeyPress */
diff --git a/frame.h b/frame.h
index b02b15d..d7c7bfe 100644
--- a/frame.h
+++ b/frame.h
@@ -27,6 +27,6 @@ extern void deactivate_focus_frame( void );
extern void synthetic_configure_notify( struct gwm_window *window );
-extern event_handler frame_handlers[], childless_handlers[];
+extern const event_handler frame_handlers[], childless_handlers[];
#endif
diff --git a/gwm.c b/gwm.c
index 10b6f8d..9ef47e6 100644
--- a/gwm.c
+++ b/gwm.c
@@ -86,7 +86,7 @@ xcb_atom_t atoms[ NUM_ATOMS ];
_NET_CURRENT_DESKTOP (0),
_NET_WORKAREA,
_NET_SUPPORTING_WM_CHECK properties to root windows. */
-static const char *atom_names[ NUM_ATOMS ] = {
+static const char *const atom_names[ NUM_ATOMS ] = {
"COMPOUND_TEXT",
"MANAGER",
"_MOTIF_WM_HINTS",
@@ -105,7 +105,7 @@ static const char *atom_names[ NUM_ATOMS ] = {
xcb_atom_t prop_atoms[ NUM_PROPS ];
xcb_atom_t prop_types[ NUM_PROPS ];
-static const xcb_extension_t *extensions[ EXTENSIONS_SIZE ] = {
+static const xcb_extension_t *const extensions[ EXTENSIONS_SIZE ] = {
#if USE_COMPOSITE
&xcb_composite_id,
#endif
@@ -355,7 +355,7 @@ static void show_window( char *label, xcb_window_t w ) {
static void show_atom( char *label, xcb_atom_t atom ) {
- static const char *predefined_names[ 69 ] = {
+ static const char *const predefined_names[ 69 ] = {
"None", "PRIMARY", "SECONDARY", "ARC", "ATOM", "BITMAP", "CARDINAL",
"COLORMAP", "CURSOR", "CUT_BUFFER0", "CUT_BUFFER1", "CUT_BUFFER2",
"CUT_BUFFER3", "CUT_BUFFER4", "CUT_BUFFER5", "CUT_BUFFER6",
@@ -397,7 +397,7 @@ extern void show_error( xcb_generic_error_t *error ) {
xcb_value_error_t *verror = (xcb_value_error_t *) error;
#if DEBUG
- static const char *type_strings[ XCB_IMPLEMENTATION + 1 ] = {
+ static const char *const type_strings[ XCB_IMPLEMENTATION + 1 ] = {
"Unknown", "Request", "Value", "Window", "Pixmap", "Atom", "Cursor",
"Font", "Match", "Drawable", "Access", "Alloc", "Colormap", "GContext",
"IDChoice", "Name", "Length", "Implementation"
@@ -437,7 +437,7 @@ extern void show_error( xcb_generic_error_t *error ) {
error->error_code >= extension_error[ EXT_RENDER ] &&
error->error_code <= extension_error[ EXT_RENDER ] +
XCB_RENDER_GLYPH ) {
- static const char *render_strings[ XCB_RENDER_GLYPH + 1 ] = {
+ static const char *const render_strings[ XCB_RENDER_GLYPH + 1 ] = {
"PictFormat", "Picture", "PictOp", "GlyphSet", "Glyph"
};
@@ -459,7 +459,7 @@ extern void show_error( xcb_generic_error_t *error ) {
#if DEBUG
static void show_event( xcb_generic_event_t *generic ) {
- static const char *event_names[ XCB_MAPPING_NOTIFY + 1 ] = {
+ static const char *const event_names[ XCB_MAPPING_NOTIFY + 1 ] = {
"Error", "Reply", "KeyPress", "KeyRelease", "ButtonPress",
"ButtonRelease", "MotionNotify", "EnterNotify", "LeaveNotify",
"FocusIn", "FocusOut", "KeymapNotify", "Expose", "GraphicsExposure",
@@ -1500,7 +1500,7 @@ static void fake_selection_request( struct gwm_window *window,
}
}
-static event_handler fake_handlers[] = {
+static const event_handler fake_handlers[] = {
NULL, /* Error */
NULL, /* Reply */
NULL, /* KeyPress */
@@ -1538,9 +1538,7 @@ static event_handler fake_handlers[] = {
NULL, /* MappingNotify */
NULL, /* (synthetic) */
NULL /* ShapeNotify */
-};
-
-static event_handler feedback_handlers[] = {
+}, feedback_handlers[] = {
NULL, /* Error */
NULL, /* Reply */
NULL, /* KeyPress */
@@ -1579,7 +1577,7 @@ static event_handler feedback_handlers[] = {
NULL /* (synthetic) */
};
-static const event_handler *handlers[] = {
+static const event_handler *const handlers[] = {
root_handlers, managed_handlers, frame_handlers, button_handlers,
fake_handlers, feedback_handlers, NULL, childless_handlers
};
@@ -1626,12 +1624,12 @@ static void setup_display( void ) {
tree_cookies = alloca( num_screens * sizeof *tree_cookies );
for( i = 0; iter.rem; i++, xcb_screen_next( &iter ) ) {
- static char wm_atom_str[ 16 ] = "WM_S";
+ char wm_atom_str[ 16 ];
xcb_depth_iterator_t depth_iter;
screens[ i ] = iter.data;
screen_atom_cookies[ i ] =
- xcb_intern_atom( c, 0, 4 + sprintf( wm_atom_str + 4, "%d", i ),
+ xcb_intern_atom( c, 0, sprintf( wm_atom_str, "WM_S%d", i ),
wm_atom_str );
for( depth_iter = xcb_screen_allowed_depths_iterator( screens[ i ] );
diff --git a/managed.c b/managed.c
index 25525c0..abb1e99 100644
--- a/managed.c
+++ b/managed.c
@@ -631,7 +631,7 @@ static void managed_shape_notify( struct gwm_window *window,
}
#endif
-event_handler managed_handlers[] = {
+const event_handler managed_handlers[] = {
NULL, /* Error */
NULL, /* Reply */
NULL, /* KeyPress */
diff --git a/managed.h b/managed.h
index 8dc1ec2..f421d64 100644
--- a/managed.h
+++ b/managed.h
@@ -8,7 +8,7 @@ extern void match_managed_shape( struct gwm_window *window );
extern void managed_property_change( struct gwm_window *window, int prop,
xcb_get_property_reply_t *p );
-extern event_handler managed_handlers[];
+extern const event_handler managed_handlers[];
extern void withdrawn_map_request( struct gwm_window *window,
xcb_map_request_event_t *ev );
diff --git a/root.c b/root.c
index dead2ed..68c6463 100644
--- a/root.c
+++ b/root.c
@@ -154,7 +154,7 @@ static void root_synthetic( struct gwm_window *root,
}
}
-event_handler root_handlers[] = {
+const event_handler root_handlers[] = {
NULL, /* Error */
NULL, /* Reply */
(event_handler) root_key_press,
diff --git a/root.h b/root.h
index b77864f..6be2272 100644
--- a/root.h
+++ b/root.h
@@ -1,6 +1,6 @@
#ifndef ROOT_H
#define ROOT_H
-extern event_handler root_handlers[];
+extern const event_handler root_handlers[];
#endif