From 656ea8c3c91e8998d55915fe2c5601adf7351d82 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sat, 12 Dec 2015 12:42:59 +0200 Subject: [PATCH] Make the code compile cleanly in C90 mode --- Makefile | 2 +- source/main.c | 41 +++++++++++++++++++++++++++++------------ 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index adb93d9..db9a8f8 100644 --- a/Makefile +++ b/Makefile @@ -1,2 +1,2 @@ geometrycompositor: source/main.c - gcc -o $@ $< -Wall -Wextra -Werror -ggdb -lX11 -lXcomposite -lXdamage -lXext -lGL + gcc -o $@ $< -Wall -Wextra -Werror -std=c90 -pedantic -ggdb -lX11 -lXcomposite -lXdamage -lXext -lGL diff --git a/source/main.c b/source/main.c index f7780a0..731323f 100644 --- a/source/main.c +++ b/source/main.c @@ -555,22 +555,28 @@ void process_create_window_event(Compositor *compositor, XCreateWindowEvent *eve void process_destroy_window_event(Compositor *compositor, XDestroyWindowEvent *event) { - CompositedScreen *screen = find_screen_by_root(compositor, event->event); + CompositedScreen *screen; + CompositedWindow *window; + + screen = find_screen_by_root(compositor, event->event); if(!screen) return; - CompositedWindow *window = find_window(screen, event->window); + window = find_window(screen, event->window); if(window) remove_window(compositor, screen, window, 1); } void process_map_event(Compositor *compositor, XMapEvent *event) { - CompositedScreen *screen = find_screen_by_root(compositor, event->event); + CompositedScreen *screen; + CompositedWindow *window; + + screen = find_screen_by_root(compositor, event->event); if(!screen) return; - CompositedWindow *window = find_window(screen, event->window); + window = find_window(screen, event->window); if(!window) return; @@ -582,11 +588,14 @@ void process_map_event(Compositor *compositor, XMapEvent *event) void process_unmap_event(Compositor *compositor, XUnmapEvent *event) { - CompositedScreen *screen = find_screen_by_root(compositor, event->event); + CompositedScreen *screen; + CompositedWindow *window; + + screen = find_screen_by_root(compositor, event->event); if(!screen) return; - CompositedWindow *window = find_window(screen, event->window); + window = find_window(screen, event->window); if(window) window->map_state = IsUnviewable; @@ -595,11 +604,13 @@ void process_unmap_event(Compositor *compositor, XUnmapEvent *event) void process_reparent_event(Compositor *compositor, XReparentEvent *event) { - CompositedScreen *screen = find_screen_by_root(compositor, event->event); + CompositedScreen *screen; + CompositedWindow *window; + + screen = find_screen_by_root(compositor, event->event); if(!screen) return; - CompositedWindow *window; if(event->parent==screen->root) window = add_window(compositor, screen, event->window); else @@ -617,11 +628,14 @@ void process_reparent_event(Compositor *compositor, XReparentEvent *event) void process_configure_event(Compositor *compositor, XConfigureEvent *event) { - CompositedScreen *screen = find_screen_by_root(compositor, event->event); + CompositedScreen *screen; + CompositedWindow *window; + + screen = find_screen_by_root(compositor, event->event); if(!screen) return; - CompositedWindow *window = find_window(screen, event->window); + window = find_window(screen, event->window); if(!window) return; @@ -642,11 +656,14 @@ void process_configure_event(Compositor *compositor, XConfigureEvent *event) void process_damage_event(Compositor *compositor, XDamageNotifyEvent *event) { - CompositedScreen *screen = find_screen_by_window(compositor, event->drawable); + CompositedScreen *screen; + CompositedWindow *window; + + screen = find_screen_by_window(compositor, event->drawable); if(!screen) return; - CompositedWindow *window = find_window(screen, event->drawable); + window = find_window(screen, event->drawable); if(window->map_state==IsViewable) mark_dirty(compositor, screen); } -- 2.45.2