[Bf-blender-cvs] [73c7aaba226] master: Cleanup: style, use braces for the window manager

Campbell Barton noreply at git.blender.org
Sat Apr 13 09:16:51 CEST 2019


Commit: 73c7aaba226349e93ca4966941f4eb051a94c097
Author: Campbell Barton
Date:   Sat Apr 13 09:15:15 2019 +0200
Branches: master
https://developer.blender.org/rB73c7aaba226349e93ca4966941f4eb051a94c097

Cleanup: style, use braces for the window manager

===================================================================

M	source/blender/windowmanager/gizmo/intern/wm_gizmo.c
M	source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
M	source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
M	source/blender/windowmanager/intern/wm.c
M	source/blender/windowmanager/intern/wm_cursors.c
M	source/blender/windowmanager/intern/wm_dragdrop.c
M	source/blender/windowmanager/intern/wm_draw.c
M	source/blender/windowmanager/intern/wm_event_system.c
M	source/blender/windowmanager/intern/wm_files.c
M	source/blender/windowmanager/intern/wm_files_link.c
M	source/blender/windowmanager/intern/wm_gesture.c
M	source/blender/windowmanager/intern/wm_gesture_ops.c
M	source/blender/windowmanager/intern/wm_init_exit.c
M	source/blender/windowmanager/intern/wm_jobs.c
M	source/blender/windowmanager/intern/wm_keymap.c
M	source/blender/windowmanager/intern/wm_keymap_utils.c
M	source/blender/windowmanager/intern/wm_menu_type.c
M	source/blender/windowmanager/intern/wm_operator_props.c
M	source/blender/windowmanager/intern/wm_operator_type.c
M	source/blender/windowmanager/intern/wm_operators.c
M	source/blender/windowmanager/intern/wm_panel_type.c
M	source/blender/windowmanager/intern/wm_playanim.c
M	source/blender/windowmanager/intern/wm_stereo.c
M	source/blender/windowmanager/intern/wm_subwindow.c
M	source/blender/windowmanager/intern/wm_window.c

===================================================================

diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo.c
index 7346fa31300..1a4141c0178 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo.c
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo.c
@@ -644,10 +644,12 @@ void WM_gizmo_properties_create(PointerRNA *ptr, const char *gtstring)
 {
 	const wmGizmoType *gzt = WM_gizmotype_find(gtstring, false);
 
-	if (gzt)
+	if (gzt) {
 		WM_gizmo_properties_create_ptr(ptr, (wmGizmoType *)gzt);
-	else
+	}
+	else {
 		RNA_pointer_create(NULL, &RNA_GizmoProperties, NULL, ptr);
+	}
 }
 
 /* similar to the function above except its uses ID properties
@@ -674,10 +676,12 @@ void WM_gizmo_properties_sanitize(PointerRNA *ptr, const bool no_context)
 	{
 		switch (RNA_property_type(prop)) {
 			case PROP_ENUM:
-				if (no_context)
+				if (no_context) {
 					RNA_def_property_flag(prop, PROP_ENUM_NO_CONTEXT);
-				else
+				}
+				else {
 					RNA_def_property_clear_flag(prop, PROP_ENUM_NO_CONTEXT);
+				}
 				break;
 			case PROP_POINTER:
 			{
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
index 42dd5e8f293..ae264480751 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
@@ -145,18 +145,18 @@ int WM_gizmo_cmp_temp_fl(const void *gz_a_ptr, const void *gz_b_ptr)
 {
 	const wmGizmo *gz_a = gz_a_ptr;
 	const wmGizmo *gz_b = gz_b_ptr;
-	if      (gz_a->temp.f < gz_b->temp.f) return -1;
-	else if (gz_a->temp.f > gz_b->temp.f) return  1;
-	else                                  return  0;
+	if      (gz_a->temp.f < gz_b->temp.f) { return -1; }
+	else if (gz_a->temp.f > gz_b->temp.f) { return  1; }
+	else                                  { return  0; }
 }
 
 int WM_gizmo_cmp_temp_fl_reverse(const void *gz_a_ptr, const void *gz_b_ptr)
 {
 	const wmGizmo *gz_a = gz_a_ptr;
 	const wmGizmo *gz_b = gz_b_ptr;
-	if      (gz_a->temp.f < gz_b->temp.f) return  1;
-	else if (gz_a->temp.f > gz_b->temp.f) return -1;
-	else                                  return  0;
+	if      (gz_a->temp.f < gz_b->temp.f) { return  1; }
+	else if (gz_a->temp.f > gz_b->temp.f) { return -1; }
+	else                                  { return  0; }
 }
 
 wmGizmo *wm_gizmogroup_find_intersected_gizmo(
@@ -636,8 +636,9 @@ static wmKeyMap *gizmogroup_tweak_modal_keymap(wmKeyConfig *keyconf, const char
 	keymap = WM_modalkeymap_get(keyconf, name);
 
 	/* this function is called for each spacetype, only needs to add map once */
-	if (keymap && keymap->modal_items)
+	if (keymap && keymap->modal_items) {
 		return NULL;
+	}
 
 	keymap = WM_modalkeymap_add(keyconf, name, modal_items);
 
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
index df9f38824b0..112943a7dba 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
@@ -345,8 +345,9 @@ static void gizmomap_prepare_drawing(
         wmGizmoMap *gzmap, const bContext *C, ListBase *draw_gizmos,
         const eWM_GizmoFlagMapDrawStep drawstep)
 {
-	if (!gzmap || BLI_listbase_is_empty(&gzmap->groups))
+	if (!gzmap || BLI_listbase_is_empty(&gzmap->groups)) {
 		return;
+	}
 
 	gzmap->is_init = false;
 
@@ -844,8 +845,9 @@ bool WM_gizmomap_select_all(bContext *C, wmGizmoMap *gzmap, const int action)
 			break;
 	}
 
-	if (changed)
+	if (changed) {
 		WM_event_add_mousemove(C);
+	}
 
 	return changed;
 }
@@ -874,12 +876,15 @@ void wm_gizmomap_handler_context_op(bContext *C, wmEventHandler_Op *handler)
 		else {
 			ARegion *ar;
 			CTX_wm_area_set(C, sa);
-			for (ar = sa->regionbase.first; ar; ar = ar->next)
-				if (ar == handler->context.region)
+			for (ar = sa->regionbase.first; ar; ar = ar->next) {
+				if (ar == handler->context.region) {
 					break;
+				}
+			}
 			/* XXX no warning print here, after full-area and back regions are remade */
-			if (ar)
+			if (ar) {
 				CTX_wm_region_set(C, ar);
+			}
 		}
 	}
 }
@@ -1198,11 +1203,13 @@ void WM_gizmoconfig_update_tag_remove(
  */
 void WM_gizmoconfig_update(struct Main *bmain)
 {
-	if (G.background)
+	if (G.background) {
 		return;
+	}
 
-	if (wm_gzmap_type_update_flag == 0)
+	if (wm_gzmap_type_update_flag == 0) {
 		return;
+	}
 
 	if (wm_gzmap_type_update_flag & WM_GIZMOMAPTYPE_GLOBAL_UPDATE_REMOVE) {
 		for (wmGizmoMapType *gzmap_type = gizmomaptypes.first;
diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c
index 2c6dcd56471..8e01094da4d 100644
--- a/source/blender/windowmanager/intern/wm.c
+++ b/source/blender/windowmanager/intern/wm.c
@@ -354,8 +354,9 @@ void wm_close_and_free(bContext *C, wmWindowManager *wm)
 	wmOperator *op;
 	wmKeyConfig *keyconf;
 
-	if (wm->autosavetimer)
+	if (wm->autosavetimer) {
 		wm_autosave_timer_ended(wm);
+	}
 
 	while ((win = BLI_pophead(&wm->windows))) {
 		/* prevent draw clear to use screen */
@@ -388,7 +389,9 @@ void wm_close_and_free(bContext *C, wmWindowManager *wm)
 		wm->undo_stack = NULL;
 	}
 
-	if (C && CTX_wm_manager(C) == wm) CTX_wm_manager_set(C, NULL);
+	if (C && CTX_wm_manager(C) == wm) {
+		CTX_wm_manager_set(C, NULL);
+	}
 }
 
 void wm_close_and_free_all(bContext *C, ListBase *wmlist)
diff --git a/source/blender/windowmanager/intern/wm_cursors.c b/source/blender/windowmanager/intern/wm_cursors.c
index de293373870..a04b3d1c843 100644
--- a/source/blender/windowmanager/intern/wm_cursors.c
+++ b/source/blender/windowmanager/intern/wm_cursors.c
@@ -114,19 +114,22 @@ void WM_cursor_set(wmWindow *win, int curs)
 #ifdef _WIN32
 	/* the default win32 cross cursor is barely visible,
 	 * only 1 pixel thick, use another one instead */
-	if (curs == CURSOR_EDIT)
+	if (curs == CURSOR_EDIT) {
 		curs = BC_CROSSCURSOR;
+	}
 #else
 	/* in case of large cursor, also use custom cursor because
 	 * large cursors don't work for system cursors */
-	if (U.curssize && curs == CURSOR_EDIT)
+	if (U.curssize && curs == CURSOR_EDIT) {
 		curs = BC_CROSSCURSOR;
+	}
 #endif
 
 	GHOST_SetCursorVisibility(win->ghostwin, 1);
 
-	if (curs == CURSOR_STD && win->modalcursor)
+	if (curs == CURSOR_STD && win->modalcursor) {
 		curs = win->modalcursor;
+	}
 
 	win->cursor = curs;
 
@@ -135,7 +138,9 @@ void WM_cursor_set(wmWindow *win, int curs)
 		GHOST_SetCursorShape(win->ghostwin, convert_cursor(curs));
 	}
 	else {
-		if ((curs < SYSCURSOR) || (curs >= BC_NUMCURSORS)) return;
+		if ((curs < SYSCURSOR) || (curs >= BC_NUMCURSORS)) {
+			return;
+		}
 
 		if (curs == SYSCURSOR) {  /* System default Cursor */
 			GHOST_SetCursorShape(win->ghostwin, convert_cursor(CURSOR_STD));
@@ -168,8 +173,9 @@ bool WM_cursor_set_from_tool(struct wmWindow *win, const ScrArea *sa, const AReg
 
 void WM_cursor_modal_set(wmWindow *win, int val)
 {
-	if (win->lastcursor == 0)
+	if (win->lastcursor == 0) {
 		win->lastcursor = win->cursor;
+	}
 	win->modalcursor = val;
 	WM_cursor_set(win, val);
 }
@@ -177,8 +183,9 @@ void WM_cursor_modal_set(wmWindow *win, int val)
 void WM_cursor_modal_restore(wmWindow *win)
 {
 	win->modalcursor = 0;
-	if (win->lastcursor)
+	if (win->lastcursor) {
 		WM_cursor_set(win, win->lastcursor);
+	}
 	win->lastcursor = 0;
 }
 
@@ -304,8 +311,9 @@ void WM_cursor_time(wmWindow *win, int nr)
 	unsigned char bitmap[16][2] = {{0}};
 	int i, idx;
 
-	if (win->lastcursor == 0)
+	if (win->lastcursor == 0) {
 		win->lastcursor = win->cursor;
+	}
 
 	memset(&mask, 0xFF, sizeof(mask));
 
@@ -315,8 +323,9 @@ void WM_cursor_time(wmWindow *win, int nr)
 		int x = idx % 2;
 		int y = idx / 2;
 
-		for (i = 0; i < 8; i++)
+		for (i = 0; i < 8; i++) {
 			bitmap[i + y * 8][x] = digit[i];
+		}
 		nr /= 10;
 	}
 
diff --git a/source/blender/windowmanager/intern/wm_dragdrop.c b/source/blender/windowmanager/intern/wm_dragdrop.c
index 11e803c4b82..92ce9957351 100644
--- a/source/blender/windowmanager/intern/wm_dragdrop.c
+++ b/source/blender/windowmanager/intern/wm_dragdrop.c
@@ -76,10 +76,13 @@ ListBase *WM_dropboxmap_find(const char *idname, int spaceid, int regionid)
 {
 	wmDropBoxMap *dm;
 
-	for (dm = dropboxes.first; dm; dm = dm->next)
-		if (dm->spaceid == spaceid && dm->regionid == regionid)
-			if (STREQLEN(idname, dm->idname, KMAP_MAX_NAME))
+	for (dm = dropboxes.first; dm; dm = dm->next) {
+		if (dm->spaceid == spaceid && dm->regionid == regionid) {
+			if (STREQLEN(idname, dm->idname, KMAP_MAX_NAME)) {
 				return &dm->dropboxes;
+			}
+		}
+	}
 
 	dm = MEM_callocN(sizeof(struct wmDropBoxMap), "dropmap list");
 	BLI_strncpy(dm->idname, idname, KMAP_MAX_NAME);
@@ -222,13 +225,19 @@ static const char *wm_dropbox_active(bContext *C, wmDrag *drag, const wmEvent *e
 	const char *name;
 
 	name = dropbox_active(C, &win->handlers, drag, event);
-	if (name) return name;
+	if (name) {
+		return name;
+	}
 
 	name = dropbox_active(C, &sa->handlers, drag, event);
-	if (name) return name;
+	if (name) {
+		return name;
+	}
 
 	name = dropbox_active(C, &ar->handlers, drag, event);
-	if (name) return name;
+	if (name) {
+		return name;
+	}
 
 	return NULL;
 }
@@ -241,8 +250,9 @@ static void wm_drop_operator_options(bContext *C, wmDrag *drag, const wmEvent *e
 	const int winsize_y = WM_window_pixels_y(win);
 
 	/* for multiwin drags, we only do this if mouse inside */
-	if (event->x < 0 || event->y < 0 || event->x > winsize_x || event->y > winsize_y)
+	if (event->x < 0 || event->y < 0 || event->x > winsize_x || event->y > winsize_y) {
 		return;
+	}
 
 	drag->opname[0] = 0;
 
@@ -361,14 +371,18 @@ static const char *wm_drag_name(wmDrag *drag)
 
 static void drag_rect_minmax(rcti *rect, int x1, int y1, int x2, int y2)
 {
-	if (rect->xmin > x1)
+	if (rect->xmin > x1) {
 		rect->xmin = x1;
-	if (rect->xmax < x2)
+	}
+	if (rect->xmax < x2) {
 		rect->xmax = x2;
-	if (rect->ymin > y1)
+	}
+	if (rect->ymin > y1) {
 		rect->ymin = y1;
-	if (rect->ymax < y2)
+	}
+	if (rect->ymax < y2) {
 		rect->ymax = y2;
+	}
 }
 
 /* called in wm_draw.c */
@@ -400,8 +414,9 @@ void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect)
 			x = cursorx - drag->sx / 2;
 			y = cursory - drag->sy / 2;
 
-			if (rect)
+			if (rect) {
 

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list