swc

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.nihaljere.xyz/swc
Log | Files | Refs | README | LICENSE

commit 397b39771bcdb00284a5aed292fc6c3c3e907f38
parent 1823ef9ab716ba09c00cc8e579b4920c5cef322c
Author: Michael Forney <mforney@mforney.org>
Date:   Thu, 23 Jan 2014 15:36:30 -0800

Add default paths for unexpected values in switch statements

This fixes some warnings when compiled with -O2

Diffstat:
Mlibswc/evdev_device.c | 1+
Mlibswc/panel.c | 26++++++++++++++------------
2 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/libswc/evdev_device.c b/libswc/evdev_device.c @@ -93,6 +93,7 @@ static void handle_rel_event(struct swc_evdev_device * device, axis = WL_POINTER_AXIS_HORIZONTAL_SCROLL; amount = AXIS_STEP_DISTANCE * wl_fixed_from_int(input_event->value); break; + default: return; } device->handler->axis(time, axis, amount); diff --git a/libswc/panel.c b/libswc/panel.c @@ -60,6 +60,7 @@ static void update_position(struct swc_panel * panel) x = screen->x + screen->width - view->width; y = screen->y + panel->offset; break; + default: return; } swc_view_move(panel->surface->view, x, y); @@ -78,6 +79,19 @@ static void dock(struct wl_client * client, struct wl_resource * resource, bool screen_changed = screen != panel->screen; uint32_t length; + switch (edge) + { + case SWC_PANEL_EDGE_TOP: + case SWC_PANEL_EDGE_BOTTOM: + length = screen->base.geometry.width; + break; + case SWC_PANEL_EDGE_LEFT: + case SWC_PANEL_EDGE_RIGHT: + length = screen->base.geometry.height; + break; + default: return; + } + if (panel->docked) wl_list_remove(&panel->view_listener.link); @@ -91,18 +105,6 @@ static void dock(struct wl_client * client, struct wl_resource * resource, panel->edge = edge; panel->docked = true; - switch (edge) - { - case SWC_PANEL_EDGE_TOP: - case SWC_PANEL_EDGE_BOTTOM: - length = panel->screen->base.geometry.width; - break; - case SWC_PANEL_EDGE_LEFT: - case SWC_PANEL_EDGE_RIGHT: - length = panel->screen->base.geometry.height; - break; - } - swc_compositor_add_surface(panel->surface); update_position(panel); swc_compositor_surface_show(panel->surface);