mirror of
https://github.com/labwc/labwc.git
synced 2025-11-11 13:30:04 -05:00
treewide: remove empty statements in switch cases
For longer cases, factor out the logic to new functions. For very short cases, just move the declaration before the switch. v2: in one case, replace the switch with if/else.
This commit is contained in:
parent
fbb92e2e30
commit
a3d6226728
5 changed files with 59 additions and 50 deletions
|
|
@ -168,24 +168,19 @@ resize_indicator_update(struct view *view)
|
|||
view_box.height = view_effective_height(view, /* use_pending */ false);
|
||||
}
|
||||
|
||||
switch (view->server->input_mode) {
|
||||
case LAB_INPUT_STATE_RESIZE:
|
||||
; /* works around "a label can only be part of a statement" */
|
||||
if (view->server->input_mode == LAB_INPUT_STATE_RESIZE) {
|
||||
struct view_size_hints hints = view_get_size_hints(view);
|
||||
snprintf(text, sizeof(text), "%d x %d",
|
||||
MAX(0, view_box.width - hints.base_width)
|
||||
/ MAX(1, hints.width_inc),
|
||||
MAX(0, view_box.height - hints.base_height)
|
||||
/ MAX(1, hints.height_inc));
|
||||
break;
|
||||
case LAB_INPUT_STATE_MOVE:
|
||||
; /* works around "a label can only be part of a statement" */
|
||||
} else if (view->server->input_mode == LAB_INPUT_STATE_MOVE) {
|
||||
struct border margin = ssd_get_margin(view->ssd);
|
||||
snprintf(text, sizeof(text), "%d , %d",
|
||||
view_box.x - margin.left,
|
||||
view_box.y - margin.top);
|
||||
break;
|
||||
default:
|
||||
} else {
|
||||
wlr_log(WLR_ERROR, "Invalid input mode for indicator update %u",
|
||||
view->server->input_mode);
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue