Index: uspace/srv/hid/compositor/compositor.c
===================================================================
--- uspace/srv/hid/compositor/compositor.c	(revision b7fd2a02e4161f4edd38548e7f8456b8021549be)
+++ uspace/srv/hid/compositor/compositor.c	(revision a35b458e9db1ca95e679799dc7c1b12c83359ca3)
@@ -177,5 +177,5 @@
 	if (!p)
 		return NULL;
-	
+
 	link_initialize(&p->link);
 	p->pos.x = coord_origin;
@@ -189,5 +189,5 @@
 	p->state = 0;
 	cursor_init(&p->cursor, CURSOR_DECODER_EMBEDDED, NULL);
-	
+
 	/* Ghost window for transformation animation. */
 	transform_identity(&p->ghost.transform);
@@ -202,5 +202,5 @@
 	p->accum_ghost.x = 0;
 	p->accum_ghost.y = 0;
-	
+
 	return p;
 }
@@ -219,5 +219,5 @@
 	if (!win)
 		return NULL;
-	
+
 	link_initialize(&win->link);
 	atomic_set(&win->ref_cnt, 0);
@@ -232,5 +232,5 @@
 	win->opacity = 255;
 	win->surface = NULL;
-	
+
 	return win;
 }
@@ -244,8 +244,8 @@
 			free(event);
 		}
-		
+
 		if (win->surface)
 			surface_destroy(win->surface);
-		
+
 		free(win);
 	}
@@ -259,5 +259,5 @@
 	transform_invert(&win_trans);
 	transform_apply_affine(&win_trans, &x, &y);
-	
+
 	/*
 	 * Since client coordinate origin is (0, 0), it is necessary to check
@@ -268,11 +268,11 @@
 	if ((x < 0) || (y < 0))
 		return false;
-	
+
 	(*x_out) = (sysarg_t) (x + 0.5);
 	(*y_out) = (sysarg_t) (y + 0.5);
-	
+
 	if (((*x_out) >= x_lim) || ((*y_out) >= y_lim))
 		return false;
-	
+
 	return true;
 }
@@ -284,5 +284,5 @@
 	double y = y_in;
 	transform_apply_affine(&win_trans, &x, &y);
-	
+
 	/*
 	 * It is assumed that compositor coordinate origin is chosen in such way,
@@ -300,15 +300,15 @@
 		sysarg_t x[4];
 		sysarg_t y[4];
-		
+
 		comp_coord_from_client(x_in, y_in, win_trans, &x[0], &y[0]);
 		comp_coord_from_client(x_in + w_in - 1, y_in, win_trans, &x[1], &y[1]);
 		comp_coord_from_client(x_in + w_in - 1, y_in + h_in - 1, win_trans, &x[2], &y[2]);
 		comp_coord_from_client(x_in, y_in + h_in - 1, win_trans, &x[3], &y[3]);
-		
+
 		(*x_out) = x[0];
 		(*y_out) = y[0];
 		(*w_out) = x[0];
 		(*h_out) = y[0];
-		
+
 		for (unsigned int i = 1; i < 4; ++i) {
 			(*x_out) = (x[i] < (*x_out)) ? x[i] : (*x_out);
@@ -317,5 +317,5 @@
 			(*h_out) = (y[i] > (*h_out)) ? y[i] : (*h_out);
 		}
-		
+
 		(*w_out) = (*w_out) - (*x_out) + 1;
 		(*h_out) = (*h_out) - (*y_out) + 1;
@@ -331,10 +331,10 @@
 {
 	fibril_mutex_lock(&viewport_list_mtx);
-	
+
 	sysarg_t x_res = coord_origin;
 	sysarg_t y_res = coord_origin;
 	sysarg_t w_res = 0;
 	sysarg_t h_res = 0;
-	
+
 	if (!list_empty(&viewport_list)) {
 		viewport_t *vp = (viewport_t *) list_first(&viewport_list);
@@ -343,5 +343,5 @@
 		surface_get_resolution(vp->surface, &w_res, &h_res);
 	}
-	
+
 	list_foreach(viewport_list, link, viewport_t, vp) {
 		sysarg_t w_vp, h_vp;
@@ -351,10 +351,10 @@
 		    &x_res, &y_res, &w_res, &h_res);
 	}
-	
+
 	viewport_bound_rect.x = x_res;
 	viewport_bound_rect.y = y_res;
 	viewport_bound_rect.w = w_res;
 	viewport_bound_rect.h = h_res;
-	
+
 	fibril_mutex_unlock(&viewport_list_mtx);
 }
@@ -363,7 +363,7 @@
 {
 	comp_update_viewport_bound_rect();
-	
+
 	fibril_mutex_lock(&pointer_list_mtx);
-	
+
 	list_foreach(pointer_list, link, pointer_t, ptr) {
 		ptr->pos.x = ptr->pos.x > viewport_bound_rect.x ? ptr->pos.x : viewport_bound_rect.x;
@@ -374,5 +374,5 @@
 		    ptr->pos.y : viewport_bound_rect.y + viewport_bound_rect.h;
 	}
-	
+
 	fibril_mutex_unlock(&pointer_list_mtx);
 }
@@ -585,5 +585,5 @@
 		}
 	}
-	
+
 	fibril_mutex_unlock(&viewport_list_mtx);
 }
@@ -601,5 +601,5 @@
 		return;
 	}
-	
+
 	errno_t rc = async_data_read_finalize(callid, event, len);
 	if (rc != EOK) {
@@ -608,5 +608,5 @@
 		return;
 	}
-	
+
 	async_answer_0(iid, EOK);
 	free(event);
@@ -638,5 +638,5 @@
 	sysarg_t pos_id = IPC_GET_ARG1(*icall);
 	sysarg_t grab_flags = IPC_GET_ARG2(*icall);
-	
+
 	/*
 	 * Filter out resize grab flags if the window
@@ -669,15 +669,15 @@
 	transform_identity(&translate);
 	transform_translate(&translate, win->dx, win->dy);
-	
+
 	transform_t scale;
 	transform_identity(&scale);
 	if ((win->fx != 1) || (win->fy != 1))
 		transform_scale(&scale, win->fx, win->fy);
-	
+
 	transform_t rotate;
 	transform_identity(&rotate);
 	if (win->angle != 0)
 		transform_rotate(&rotate, win->angle);
-	
+
 	transform_t transform;
 	transform_t temp;
@@ -689,5 +689,5 @@
 	temp = transform;
 	transform_product(&transform, &temp, &scale);
-	
+
 	win->transform = transform;
 }
@@ -698,5 +698,5 @@
 	size_t size;
 	unsigned int flags;
-	
+
 	/* Start sharing resized window with client. */
 	if (!async_share_out_receive(&callid, &size, &flags)) {
@@ -704,5 +704,5 @@
 		return;
 	}
-	
+
 	void *new_cell_storage;
 	errno_t rc = async_share_out_finalize(callid, &new_cell_storage);
@@ -711,5 +711,5 @@
 		return;
 	}
-	
+
 	/* Create new surface for the resized window. */
 	surface_t *new_surface = surface_create(IPC_GET_ARG3(*icall),
@@ -720,57 +720,57 @@
 		return;
 	}
-	
+
 	sysarg_t offset_x = IPC_GET_ARG1(*icall);
 	sysarg_t offset_y = IPC_GET_ARG2(*icall);
 	window_placement_flags_t placement_flags =
 	    (window_placement_flags_t) IPC_GET_ARG5(*icall);
-	
+
 	comp_update_viewport_bound_rect();
-	
+
 	/* Switch new surface with old surface and calculate damage. */
 	fibril_mutex_lock(&window_list_mtx);
-	
+
 	sysarg_t old_width = 0;
 	sysarg_t old_height = 0;
-	
+
 	if (win->surface) {
 		surface_get_resolution(win->surface, &old_width, &old_height);
 		surface_destroy(win->surface);
 	}
-	
+
 	win->surface = new_surface;
-	
+
 	sysarg_t new_width = 0;
 	sysarg_t new_height = 0;
 	surface_get_resolution(win->surface, &new_width, &new_height);
-	
+
 	if (placement_flags & WINDOW_PLACEMENT_CENTER_X)
 		win->dx = viewport_bound_rect.x + viewport_bound_rect.w / 2 -
 		    new_width / 2;
-	
+
 	if (placement_flags & WINDOW_PLACEMENT_CENTER_Y)
 		win->dy = viewport_bound_rect.y + viewport_bound_rect.h / 2 -
 		    new_height / 2;
-	
+
 	if (placement_flags & WINDOW_PLACEMENT_LEFT)
 		win->dx = viewport_bound_rect.x;
-	
+
 	if (placement_flags & WINDOW_PLACEMENT_TOP)
 		win->dy = viewport_bound_rect.y;
-	
+
 	if (placement_flags & WINDOW_PLACEMENT_RIGHT)
 		win->dx = viewport_bound_rect.x + viewport_bound_rect.w -
 		    new_width;
-	
+
 	if (placement_flags & WINDOW_PLACEMENT_BOTTOM)
 		win->dy = viewport_bound_rect.y + viewport_bound_rect.h -
 		    new_height;
-	
+
 	if (placement_flags & WINDOW_PLACEMENT_ABSOLUTE_X)
 		win->dx = coord_origin + offset_x;
-	
+
 	if (placement_flags & WINDOW_PLACEMENT_ABSOLUTE_Y)
 		win->dy = coord_origin + offset_y;
-	
+
 	/* Transform the window and calculate damage. */
 	sysarg_t x1;
@@ -778,30 +778,30 @@
 	sysarg_t width1;
 	sysarg_t height1;
-	
+
 	comp_coord_bounding_rect(0, 0, old_width, old_height, win->transform,
 	    &x1, &y1, &width1, &height1);
-	
+
 	comp_recalc_transform(win);
-	
+
 	sysarg_t x2;
 	sysarg_t y2;
 	sysarg_t width2;
 	sysarg_t height2;
-	
+
 	comp_coord_bounding_rect(0, 0, new_width, new_height, win->transform,
 	    &x2, &y2, &width2, &height2);
-	
+
 	sysarg_t x;
 	sysarg_t y;
 	sysarg_t width;
 	sysarg_t height;
-	
+
 	rectangle_union(x1, y1, width1, height1, x2, y2, width2, height2,
 	    &x, &y, &width, &height);
-	
+
 	fibril_mutex_unlock(&window_list_mtx);
-	
+
 	comp_damage(x, y, width, height);
-	
+
 	async_answer_0(iid, EOK);
 }
@@ -810,5 +810,5 @@
 {
 	fibril_mutex_lock(&window_list_mtx);
-	
+
 	list_foreach(window_list, link, window_t, window) {
 		if (window == target) {
@@ -818,5 +818,5 @@
 		}
 	}
-	
+
 	fibril_mutex_unlock(&window_list_mtx);
 	free(event);
@@ -826,5 +826,5 @@
 {
 	fibril_mutex_lock(&window_list_mtx);
-	
+
 	window_t *win = (window_t *) list_first(&window_list);
 	if (win)
@@ -832,5 +832,5 @@
 	else
 		free(event);
-	
+
 	fibril_mutex_unlock(&window_list_mtx);
 }
@@ -914,5 +914,5 @@
 				return;
 			}
-			
+
 			win->flags = IPC_GET_ARG1(call);
 
@@ -950,8 +950,8 @@
 				event_unfocus->type = ET_WINDOW_UNFOCUS;
 			}
-			
+
 			async_answer_2(callid, EOK, win->in_dsid, win->out_dsid);
 			fibril_mutex_unlock(&window_list_mtx);
-			
+
 			if (event_unfocus && win_unfocus) {
 				comp_post_event_win(event_unfocus, win_unfocus);
@@ -1102,5 +1102,5 @@
 	loc_service_unregister(winreg_id);
 	input_disconnect();
-	
+
 	/* Close all clients and their windows. */
 	fibril_mutex_lock(&window_list_mtx);
@@ -1114,7 +1114,7 @@
 	}
 	fibril_mutex_unlock(&window_list_mtx);
-	
+
 	async_answer_0(iid, EOK);
-	
+
 	/* All fibrils of the compositor will terminate soon. */
 }
@@ -1125,12 +1125,12 @@
 	/* Release viewport resources. */
 	fibril_mutex_lock(&viewport_list_mtx);
-	
+
 	list_remove(&vp->link);
 	viewport_destroy(vp);
-	
+
 	fibril_mutex_unlock(&viewport_list_mtx);
-	
+
 	async_answer_0(iid, EOK);
-	
+
 	comp_restrict_pointers();
 	comp_damage(0, 0, UINT32_MAX, UINT32_MAX);
@@ -1187,9 +1187,9 @@
 
 	async_exch_t *exch = async_exchange_begin(sess);
-	
+
 	port_id_t port;
 	rc = async_create_callback_port(exch, INTERFACE_VISUALIZER_CB, 0, 0,
 	    vsl_notifications, NULL, &port);
-	
+
 	async_exchange_end(exch);
 
@@ -1265,8 +1265,8 @@
 	if (claimed)
 		visualizer_yield(vp->sess);
-	
+
 	if (vp->sess != NULL)
 		async_hangup(vp->sess);
-	
+
 	free(vp);
 	free(vsl_name);
@@ -1295,22 +1295,22 @@
 		double cx = 0;
 		double cy = 0;
-		
+
 		if (pointer->grab_flags & GF_MOVE_X)
 			cx = 1;
-		
+
 		if (pointer->grab_flags & GF_MOVE_Y)
 			cy = 1;
-		
+
 		if (((scale) || (resize)) && (win->angle != 0)) {
 			transform_t rotate;
 			transform_identity(&rotate);
-			
+
 			transform_rotate(&rotate, win->angle);
 			transform_apply_linear(&rotate, &cx, &cy);
 		}
-		
+
 		cx = (cx < 0) ? (-1 * cx) : cx;
 		cy = (cy < 0) ? (-1 * cy) : cy;
-		
+
 		win->dx += (cx * dx);
 		win->dy += (cy * dy);
@@ -1468,5 +1468,5 @@
 		rect3->w = w_u - w_i - x_i + x_u + 1;
 		rect3->h = h_u;
-		
+
 		rect4->x = x_u;
 		rect4->y = y_i + h_i - 1;
@@ -1481,9 +1481,9 @@
 {
 	/* XXX TODO Use absolute coordinates directly */
-	
+
 	pointer_t *pointer = input_pointer(input);
-	
+
 	sysarg_t width, height;
-	
+
 	fibril_mutex_lock(&viewport_list_mtx);
 	if (list_empty(&viewport_list)) {
@@ -1501,5 +1501,5 @@
 	pos_in_viewport.x = x * width / max_x;
 	pos_in_viewport.y = y * height / max_y;
-	
+
 	/* Calculate offset from pointer */
 	fibril_mutex_lock(&pointer_list_mtx);
@@ -1508,5 +1508,5 @@
 	delta.y = (vp_pos.y + pos_in_viewport.y) - pointer->pos.y;
 	fibril_mutex_unlock(&pointer_list_mtx);
-	
+
 	return comp_mouse_move(input, delta.x, delta.y);
 }
@@ -1515,29 +1515,29 @@
 {
 	pointer_t *pointer = input_pointer(input);
-	
+
 	comp_update_viewport_bound_rect();
-	
+
 	/* Update pointer position. */
 	fibril_mutex_lock(&pointer_list_mtx);
-	
+
 	desktop_point_t old_pos = pointer->pos;
-	
+
 	sysarg_t cursor_width;
 	sysarg_t cursor_height;
 	surface_get_resolution(pointer->cursor.states[pointer->state],
 	     &cursor_width, &cursor_height);
-	
+
 	if (pointer->pos.x + dx < viewport_bound_rect.x)
 		dx = -1 * (pointer->pos.x - viewport_bound_rect.x);
-	
+
 	if (pointer->pos.y + dy < viewport_bound_rect.y)
 		dy = -1 * (pointer->pos.y - viewport_bound_rect.y);
-	
+
 	if (pointer->pos.x + dx > viewport_bound_rect.x + viewport_bound_rect.w)
 		dx = (viewport_bound_rect.x + viewport_bound_rect.w - pointer->pos.x);
-	
+
 	if (pointer->pos.y + dy > viewport_bound_rect.y + viewport_bound_rect.h)
 		dy = (viewport_bound_rect.y + viewport_bound_rect.h - pointer->pos.y);
-	
+
 	pointer->pos.x += dx;
 	pointer->pos.y += dy;
@@ -1545,5 +1545,5 @@
 	comp_damage(old_pos.x, old_pos.y, cursor_width, cursor_height);
 	comp_damage(old_pos.x + dx, old_pos.y + dy, cursor_width, cursor_height);
-	
+
 	fibril_mutex_lock(&window_list_mtx);
 	fibril_mutex_lock(&pointer_list_mtx);
@@ -1663,5 +1663,5 @@
 	sysarg_t dmg_width = 0;
 	sysarg_t dmg_height = 0;
-	
+
 #if ANIMATE_WINDOW_TRANSFORMS == 0
 	desktop_rect_t dmg_rect1, dmg_rect2, dmg_rect3, dmg_rect4;
@@ -1738,11 +1738,11 @@
 				link_initialize(&event_top->link);
 				event_top->type = ET_WINDOW_RESIZE;
-				
+
 				event_top->data.resize.offset_x = 0;
 				event_top->data.resize.offset_y = 0;
-				
+
 				int dx = (int) (((double) width) * (scale_back_x - 1.0));
 				int dy = (int) (((double) height) * (scale_back_y - 1.0));
-				
+
 				if (pointer->grab_flags & GF_RESIZE_X)
 					event_top->data.resize.width =
@@ -1750,5 +1750,5 @@
 				else
 					event_top->data.resize.width = width;
-				
+
 				if (pointer->grab_flags & GF_RESIZE_Y)
 					event_top->data.resize.height =
@@ -1756,5 +1756,5 @@
 				else
 					event_top->data.resize.height = height;
-				
+
 				event_top->data.resize.placement_flags =
 				    WINDOW_PLACEMENT_ANY;
@@ -1764,5 +1764,5 @@
 
 		} else if (within_client && (pointer->grab_flags == GF_EMPTY) && (top == win)) {
-			
+
 			/* Notify top-level window about mouse release. */
 			event_top = (window_event_t *) malloc(sizeof(window_event_t));
@@ -1777,5 +1777,5 @@
 			}
 			pointer->grab_flags = GF_EMPTY;
-			
+
 		} else {
 			pointer->grab_flags = GF_EMPTY;
@@ -1813,5 +1813,5 @@
 	active = true;
 	comp_damage(0, 0, UINT32_MAX, UINT32_MAX);
-	
+
 	return EOK;
 }
@@ -1910,14 +1910,14 @@
 				return ENOMEM;
 			}
-			
+
 			sysarg_t width, height;
 			surface_get_resolution(win->surface, &width, &height);
-			
+
 			link_initialize(&event->link);
 			event->type = ET_WINDOW_RESIZE;
-			
+
 			event->data.resize.offset_x = 0;
 			event->data.resize.offset_y = 0;
-			
+
 			switch (key) {
 			case KC_T:
@@ -1942,7 +1942,7 @@
 				break;
 			}
-			
+
 			event->data.resize.placement_flags = WINDOW_PLACEMENT_ANY;
-			
+
 			fibril_mutex_unlock(&window_list_mtx);
 			comp_post_event_top(event);
@@ -2075,5 +2075,5 @@
 				break;
 			}
-			
+
 			sysarg_t x = vp->pos.x;
 			sysarg_t y = vp->pos.y;
@@ -2196,5 +2196,5 @@
 {
 	fibril_mutex_lock(&discovery_mtx);
-	
+
 	/* Create viewports and connect them to visualizers. */
 	category_id_t cat_id;
@@ -2202,5 +2202,5 @@
 	if (rc != EOK)
 		goto ret;
-	
+
 	service_id_t *svcs;
 	size_t svcs_cnt = 0;
@@ -2208,5 +2208,5 @@
 	if (rc != EOK)
 		goto ret;
-	
+
 	fibril_mutex_lock(&viewport_list_mtx);
 	for (size_t i = 0; i < svcs_cnt; ++i) {
@@ -2218,8 +2218,8 @@
 			}
 		}
-		
+
 		if (exists)
 			continue;
-		
+
 		viewport_t *vp = viewport_create(svcs[i]);
 		if (vp != NULL)
@@ -2227,8 +2227,8 @@
 	}
 	fibril_mutex_unlock(&viewport_list_mtx);
-	
+
 	if (!list_empty(&viewport_list))
 		input_activate(input);
-	
+
 ret:
 	fibril_mutex_unlock(&discovery_mtx);
@@ -2244,11 +2244,11 @@
 	/* Coordinates of the central pixel. */
 	coord_origin = UINT32_MAX / 4;
-	
+
 	/* Color of the viewport background. Must be opaque. */
 	bg_color = PIXEL(255, 69, 51, 103);
-	
+
 	/* Register compositor server. */
 	async_set_fallback_port_handler(client_connection, NULL);
-	
+
 	errno_t rc = loc_server_register(NAME);
 	if (rc != EOK) {
@@ -2256,10 +2256,10 @@
 		return -1;
 	}
-	
+
 	server_name = name;
-	
+
 	char svc[LOC_NAME_MAXLEN + 1];
 	snprintf(svc, LOC_NAME_MAXLEN, "%s/%s", NAMESPACE, server_name);
-	
+
 	service_id_t service_id;
 	rc = loc_service_register(svc, &service_id);
@@ -2268,5 +2268,5 @@
 		return rc;
 	}
-	
+
 	/* Prepare window registrator (entrypoint for clients). */
 	char winreg[LOC_NAME_MAXLEN + 1];
@@ -2276,5 +2276,5 @@
 		return -1;
 	}
-	
+
 	/* Establish input bidirectional connection. */
 	rc = input_connect(input_svc);
@@ -2283,5 +2283,5 @@
 		return rc;
 	}
-	
+
 	rc = loc_register_cat_change_cb(category_change_cb);
 	if (rc != EOK) {
@@ -2290,10 +2290,10 @@
 		return rc;
 	}
-	
+
 	discover_viewports();
-	
+
 	comp_restrict_pointers();
 	comp_damage(0, 0, UINT32_MAX, UINT32_MAX);
-	
+
 	return EOK;
 }
@@ -2310,15 +2310,15 @@
 		return 1;
 	}
-	
+
 	printf("%s: HelenOS Compositor server\n", NAME);
-	
+
 	errno_t rc = compositor_srv_init(argv[1], argv[2]);
 	if (rc != EOK)
 		return rc;
-	
+
 	printf("%s: Accepting connections\n", NAME);
 	task_retval(0);
 	async_manager();
-	
+
 	/* Never reached */
 	return 0;
