turn on -Wfloat-conversion
This commit is contained in:
		
							
								
								
									
										2
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								Makefile
									
									
									
									
									
								
							| @@ -6,7 +6,7 @@ include config.mk | ||||
| # flags for compiling | ||||
| DWLCPPFLAGS = -I. -DWLR_USE_UNSTABLE -D_POSIX_C_SOURCE=200809L -DVERSION=\"$(VERSION)\" $(XWAYLAND) | ||||
| DWLDEVCFLAGS = -g -pedantic -Wall -Wextra -Wdeclaration-after-statement -Wno-unused-parameter -Wshadow -Wunused-macros\ | ||||
| 	-Werror=strict-prototypes -Werror=implicit -Werror=return-type -Werror=incompatible-pointer-types | ||||
| 	-Werror=strict-prototypes -Werror=implicit -Werror=return-type -Werror=incompatible-pointer-types -Wfloat-conversion | ||||
|  | ||||
| # CFLAGS / LDFLAGS | ||||
| PKGS      = wlroots wayland-server xkbcommon libinput $(XLIBS) | ||||
|   | ||||
							
								
								
									
										12
									
								
								config.def.h
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								config.def.h
									
									
									
									
									
								
							| @@ -12,7 +12,7 @@ static const float bordercolor[]           = COLOR(0x444444ff); | ||||
| static const float focuscolor[]            = COLOR(0x005577ff); | ||||
| static const float urgentcolor[]           = COLOR(0xff0000ff); | ||||
| /* To conform the xdg-protocol, set the alpha to zero to restore the old behavior */ | ||||
| static const float fullscreen_bg[]         = {0.1, 0.1, 0.1, 1.0}; /* You can also use glsl colors */ | ||||
| static const float fullscreen_bg[]         = {0.1f, 0.1f, 0.1f, 1.0f}; /* You can also use glsl colors */ | ||||
|  | ||||
| /* tagging - TAGCOUNT must be no greater than 31 */ | ||||
| #define TAGCOUNT (9) | ||||
| @@ -39,12 +39,12 @@ static const Layout layouts[] = { | ||||
| /* monitors */ | ||||
| /* NOTE: ALWAYS add a fallback rule, even if you are completely sure it won't be used */ | ||||
| static const MonitorRule monrules[] = { | ||||
| 	/* name       mfact nmaster scale layout       rotate/reflect                x    y */ | ||||
| 	/* name       mfact  nmaster scale layout       rotate/reflect                x    y */ | ||||
| 	/* example of a HiDPI laptop monitor: | ||||
| 	{ "eDP-1",    0.5,  1,      2,    &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL,   -1,  -1 }, | ||||
| 	{ "eDP-1",    0.5f,  1,      2,    &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL,   -1,  -1 }, | ||||
| 	*/ | ||||
| 	/* defaults */ | ||||
| 	{ NULL,       0.55, 1,      1,    &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL,   -1,  -1 }, | ||||
| 	{ NULL,       0.55f, 1,      1,    &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL,   -1,  -1 }, | ||||
| }; | ||||
|  | ||||
| /* keyboard */ | ||||
| @@ -126,8 +126,8 @@ static const Key keys[] = { | ||||
| 	{ MODKEY,                    XKB_KEY_k,          focusstack,     {.i = -1} }, | ||||
| 	{ MODKEY,                    XKB_KEY_i,          incnmaster,     {.i = +1} }, | ||||
| 	{ MODKEY,                    XKB_KEY_d,          incnmaster,     {.i = -1} }, | ||||
| 	{ MODKEY,                    XKB_KEY_h,          setmfact,       {.f = -0.05} }, | ||||
| 	{ MODKEY,                    XKB_KEY_l,          setmfact,       {.f = +0.05} }, | ||||
| 	{ MODKEY,                    XKB_KEY_h,          setmfact,       {.f = -0.05f} }, | ||||
| 	{ MODKEY,                    XKB_KEY_l,          setmfact,       {.f = +0.05f} }, | ||||
| 	{ MODKEY,                    XKB_KEY_Return,     zoom,           {0} }, | ||||
| 	{ MODKEY,                    XKB_KEY_Tab,        view,           {0} }, | ||||
| 	{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_C,          killclient,     {0} }, | ||||
|   | ||||
							
								
								
									
										19
									
								
								dwl.c
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								dwl.c
									
									
									
									
									
								
							| @@ -65,6 +65,7 @@ | ||||
| /* macros */ | ||||
| #define MAX(A, B)               ((A) > (B) ? (A) : (B)) | ||||
| #define MIN(A, B)               ((A) < (B) ? (A) : (B)) | ||||
| #define ROUND(X)                ((int)((X < 0) ? (X - 0.5) : (X + 0.5))) | ||||
| #define CLEANMASK(mask)         (mask & ~WLR_MODIFIER_CAPS) | ||||
| #define VISIBLEON(C, M)         ((M) && (C)->mon == (M) && ((C)->tags & (M)->tagset[(M)->seltags])) | ||||
| #define LENGTH(X)               (sizeof X / sizeof X[0]) | ||||
| @@ -196,7 +197,7 @@ struct Monitor { | ||||
| 	unsigned int seltags; | ||||
| 	unsigned int sellt; | ||||
| 	uint32_t tagset[2]; | ||||
| 	double mfact; | ||||
| 	float mfact; | ||||
| 	int gamma_lut_changed; | ||||
| 	int nmaster; | ||||
| 	char ltsymbol[16]; | ||||
| @@ -1621,17 +1622,17 @@ motionnotify(uint32_t time) | ||||
| 	} | ||||
|  | ||||
| 	/* Update drag icon's position */ | ||||
| 	wlr_scene_node_set_position(&drag_icon->node, cursor->x, cursor->y); | ||||
| 	wlr_scene_node_set_position(&drag_icon->node, ROUND(cursor->x), ROUND(cursor->y)); | ||||
|  | ||||
| 	/* If we are currently grabbing the mouse, handle and return */ | ||||
| 	if (cursor_mode == CurMove) { | ||||
| 		/* Move the grabbed client to the new position. */ | ||||
| 		resize(grabc, (struct wlr_box){.x = cursor->x - grabcx, .y = cursor->y - grabcy, | ||||
| 		resize(grabc, (struct wlr_box){.x = ROUND(cursor->x) - grabcx, .y = ROUND(cursor->y) - grabcy, | ||||
| 			.width = grabc->geom.width, .height = grabc->geom.height}, 1); | ||||
| 		return; | ||||
| 	} else if (cursor_mode == CurResize) { | ||||
| 		resize(grabc, (struct wlr_box){.x = grabc->geom.x, .y = grabc->geom.y, | ||||
| 			.width = cursor->x - grabc->geom.x, .height = cursor->y - grabc->geom.y}, 1); | ||||
| 			.width = ROUND(cursor->x) - grabc->geom.x, .height = ROUND(cursor->y) - grabc->geom.y}, 1); | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| @@ -1683,8 +1684,8 @@ moveresize(const Arg *arg) | ||||
| 	setfloating(grabc, 1); | ||||
| 	switch (cursor_mode = arg->ui) { | ||||
| 	case CurMove: | ||||
| 		grabcx = cursor->x - grabc->geom.x; | ||||
| 		grabcy = cursor->y - grabc->geom.y; | ||||
| 		grabcx = ROUND(cursor->x) - grabc->geom.x; | ||||
| 		grabcy = ROUND(cursor->y) - grabc->geom.y; | ||||
| 		wlr_cursor_set_xcursor(cursor, cursor_mgr, "fleur"); | ||||
| 		break; | ||||
| 	case CurResize: | ||||
| @@ -2105,7 +2106,7 @@ setmfact(const Arg *arg) | ||||
|  | ||||
| 	if (!arg || !selmon || !selmon->lt[selmon->sellt]->arrange) | ||||
| 		return; | ||||
| 	f = arg->f < 1.0 ? arg->f + selmon->mfact : arg->f - 1.0; | ||||
| 	f = arg->f < 1.0f ? arg->f + selmon->mfact : arg->f - 1.0f; | ||||
| 	if (f < 0.1 || f > 0.9) | ||||
| 		return; | ||||
| 	selmon->mfact = f; | ||||
| @@ -2277,7 +2278,7 @@ setup(void) | ||||
| 	wl_signal_add(&session_lock_mgr->events.new_lock, &lock_listener); | ||||
| 	LISTEN_STATIC(&session_lock_mgr->events.destroy, destroysessionmgr); | ||||
| 	locked_bg = wlr_scene_rect_create(layers[LyrBlock], sgeom.width, sgeom.height, | ||||
| 			(float [4]){0.1, 0.1, 0.1, 1.0}); | ||||
| 			(float [4]){0.1f, 0.1f, 0.1f, 1.0f}); | ||||
| 	wlr_scene_node_set_enabled(&locked_bg->node, 0); | ||||
|  | ||||
| 	/* Use decoration protocols to negotiate server-side decorations */ | ||||
| @@ -2466,7 +2467,7 @@ tile(Monitor *m) | ||||
| 		return; | ||||
|  | ||||
| 	if (n > m->nmaster) | ||||
| 		mw = m->nmaster ? m->w.width * m->mfact : 0; | ||||
| 		mw = m->nmaster ? ROUND(m->w.width * m->mfact) : 0; | ||||
| 	else | ||||
| 		mw = m->w.width; | ||||
| 	i = my = ty = 0; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user