[Helper] Add a rofi_fallthrough macro to tell compiler fallthrough is intentional
This commit is contained in:
@@ -455,6 +455,19 @@ void helper_select_next_matching_mode(void);
|
|||||||
* Switch to the previous matching method.
|
* Switch to the previous matching method.
|
||||||
*/
|
*/
|
||||||
void helper_select_previous_matching_mode(void);
|
void helper_select_previous_matching_mode(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to indicate fallthrough. This will help
|
||||||
|
* gcc/llvm warning/static code analysis.
|
||||||
|
*/
|
||||||
|
#if __has_attribute(__fallthrough__)
|
||||||
|
#define rofi_fallthrough __attribute__((__fallthrough__))
|
||||||
|
#else
|
||||||
|
#define rofi_fallthrough \
|
||||||
|
do { \
|
||||||
|
} while (0) /* fallthrough */
|
||||||
|
#endif
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
/**@} */
|
/**@} */
|
||||||
|
@@ -396,30 +396,30 @@ static void rofi_view_calculate_window_position(RofiViewState *state) {
|
|||||||
switch (location) {
|
switch (location) {
|
||||||
case WL_NORTH_WEST:
|
case WL_NORTH_WEST:
|
||||||
state->x = CacheState.mon.x;
|
state->x = CacheState.mon.x;
|
||||||
/* FALLTHRU */
|
rofi_fallthrough;
|
||||||
case WL_NORTH:
|
case WL_NORTH:
|
||||||
state->y = CacheState.mon.y;
|
state->y = CacheState.mon.y;
|
||||||
break;
|
break;
|
||||||
case WL_NORTH_EAST:
|
case WL_NORTH_EAST:
|
||||||
state->y = CacheState.mon.y;
|
state->y = CacheState.mon.y;
|
||||||
/* FALLTHRU */
|
rofi_fallthrough;
|
||||||
case WL_EAST:
|
case WL_EAST:
|
||||||
state->x = CacheState.mon.x + CacheState.mon.w;
|
state->x = CacheState.mon.x + CacheState.mon.w;
|
||||||
break;
|
break;
|
||||||
case WL_SOUTH_EAST:
|
case WL_SOUTH_EAST:
|
||||||
state->x = CacheState.mon.x + CacheState.mon.w;
|
state->x = CacheState.mon.x + CacheState.mon.w;
|
||||||
/* FALLTHRU */
|
rofi_fallthrough;
|
||||||
case WL_SOUTH:
|
case WL_SOUTH:
|
||||||
state->y = CacheState.mon.y + CacheState.mon.h;
|
state->y = CacheState.mon.y + CacheState.mon.h;
|
||||||
break;
|
break;
|
||||||
case WL_SOUTH_WEST:
|
case WL_SOUTH_WEST:
|
||||||
state->y = CacheState.mon.y + CacheState.mon.h;
|
state->y = CacheState.mon.y + CacheState.mon.h;
|
||||||
/* FALLTHRU */
|
rofi_fallthrough;
|
||||||
case WL_WEST:
|
case WL_WEST:
|
||||||
state->x = CacheState.mon.x;
|
state->x = CacheState.mon.x;
|
||||||
break;
|
break;
|
||||||
case WL_CENTER:;
|
case WL_CENTER:;
|
||||||
/* FALLTHRU */
|
rofi_fallthrough;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -2057,10 +2057,10 @@ void rofi_view_trigger_action(RofiViewState *state, BindingsScope scope,
|
|||||||
return;
|
return;
|
||||||
case WIDGET_TRIGGER_ACTION_RESULT_GRAB_MOTION_END:
|
case WIDGET_TRIGGER_ACTION_RESULT_GRAB_MOTION_END:
|
||||||
target = NULL;
|
target = NULL;
|
||||||
/* FALLTHRU */
|
rofi_fallthrough;
|
||||||
case WIDGET_TRIGGER_ACTION_RESULT_GRAB_MOTION_BEGIN:
|
case WIDGET_TRIGGER_ACTION_RESULT_GRAB_MOTION_BEGIN:
|
||||||
state->mouse.motion_target = target;
|
state->mouse.motion_target = target;
|
||||||
/* FALLTHRU */
|
rofi_fallthrough;
|
||||||
case WIDGET_TRIGGER_ACTION_RESULT_HANDLED:
|
case WIDGET_TRIGGER_ACTION_RESULT_HANDLED:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -34,6 +34,7 @@
|
|||||||
#include <widgets/textbox.h>
|
#include <widgets/textbox.h>
|
||||||
#include <widgets/widget.h>
|
#include <widgets/widget.h>
|
||||||
|
|
||||||
|
#include "helper.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "theme.h"
|
#include "theme.h"
|
||||||
#include "view.h"
|
#include "view.h"
|
||||||
@@ -120,7 +121,7 @@ struct _listview {
|
|||||||
xcb_timestamp_t last_click;
|
xcb_timestamp_t last_click;
|
||||||
listview_mouse_activated_cb mouse_activated;
|
listview_mouse_activated_cb mouse_activated;
|
||||||
void *mouse_activated_data;
|
void *mouse_activated_data;
|
||||||
|
|
||||||
listview_page_changed_cb page_callback;
|
listview_page_changed_cb page_callback;
|
||||||
|
|
||||||
char *listview_name;
|
char *listview_name;
|
||||||
@@ -757,7 +758,7 @@ static WidgetTriggerActionResult listview_element_trigger_action(
|
|||||||
break;
|
break;
|
||||||
case ACCEPT_HOVERED_CUSTOM:
|
case ACCEPT_HOVERED_CUSTOM:
|
||||||
custom = TRUE;
|
custom = TRUE;
|
||||||
/* FALLTHRU */
|
rofi_fallthrough;
|
||||||
case ACCEPT_HOVERED_ENTRY:
|
case ACCEPT_HOVERED_ENTRY:
|
||||||
listview_set_selected(lv, lv->last_offset + i);
|
listview_set_selected(lv, lv->last_offset + i);
|
||||||
lv->mouse_activated(lv, custom, lv->mouse_activated_data);
|
lv->mouse_activated(lv, custom, lv->mouse_activated_data);
|
||||||
|
@@ -1172,13 +1172,13 @@ static gboolean x11_button_to_nk_bindings_scroll(guint32 x11_button,
|
|||||||
switch (x11_button) {
|
switch (x11_button) {
|
||||||
case 4:
|
case 4:
|
||||||
*steps = -1;
|
*steps = -1;
|
||||||
/* fallthrough */
|
rofi_fallthrough;
|
||||||
case 5:
|
case 5:
|
||||||
*axis = NK_BINDINGS_SCROLL_AXIS_VERTICAL;
|
*axis = NK_BINDINGS_SCROLL_AXIS_VERTICAL;
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
*steps = -1;
|
*steps = -1;
|
||||||
/* fallthrough */
|
rofi_fallthrough;
|
||||||
case 7:
|
case 7:
|
||||||
*axis = NK_BINDINGS_SCROLL_AXIS_HORIZONTAL;
|
*axis = NK_BINDINGS_SCROLL_AXIS_HORIZONTAL;
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user