1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
dragging_window = value_from_previous_frame
for event in events() do
	if event == mouse_down then
		if over_window then
			dragging_window = window_id
		else
			dragging_window = NULL
		end
	elif event == mouse_up then
		dragging_window = NUL
	elif event == mouse_move then
		if dragging_window != NULL then
			move_window( dragging_window, move_x_amount, move_y_amount )
		end
	end
	/* any other event handling stuff */
end