Example #1
0
sge::wlinput::processor::processor(
	fcppt::log::object &_log,
	sge::window::object const &_window,
	sge::window::system const &_system
)
:
	sge::input::processor(),
	log_{
		_log
	},
	system_processor_{
		fcppt::cast::dynamic_exn<
			awl::backends::wayland::system::event::processor &
		>(
			_system.awl_system_event_processor()
		)
	},
	window_{
		fcppt::cast::dynamic_exn<
			awl::backends::wayland::window::object &
		>(
			_window.awl_object()
		)
	},
	xkb_context_{},
	focus_discover_{},
	focus_remove_{},
	cursor_discover_{},
	cursor_remove_{},
	cursors_(
		sge::wlinput::initial_objects<
			sge::wlinput::cursor::object,
			awl::backends::wayland::system::seat::caps::pointer
		>(
			sge::wlinput::cursor::create(
				window_
			),
			system_processor_.seats()
		)
	),
	foci_(
		sge::wlinput::initial_objects<
			sge::wlinput::focus::object,
			awl::backends::wayland::system::seat::caps::keyboard
		>(
			sge::wlinput::focus::create(
				_log,
				xkb_context_,
				system_processor_.fd_processor(),
				window_
			),
			system_processor_.seats()
		)
	),
	start_event_{
		system_processor_.fd_processor().post(
			awl::backends::posix::callback{
				std::bind(
					&sge::wlinput::processor::init,
					this,
					std::placeholders::_1
				)
			}
		)
	},
	seat_added_connection_{
		system_processor_.seat_added_callback(
			awl::backends::wayland::system::event::seat_added_callback{
				std::bind(
					&sge::wlinput::processor::add_seat,
					this,
					std::placeholders::_1
				)
			}
		)
	},
	seat_removed_connection_{
		system_processor_.seat_removed_callback(
			awl::backends::wayland::system::event::seat_removed_callback{
				std::bind(
					&sge::wlinput::processor::remove_seat,
					this,
					std::placeholders::_1
				)
			}
		)
	},
	seat_connections_{}
{
}
Example #2
0
sge::dinput::processor::processor(
	fcppt::log::object &_log,
	sge::window::object const &_window,
	sge::window::system const &_window_system
)
:
	log_{
		_log
	},
	dinput_(
		sge::dinput::create_dinput()
	),
	windows_window_(
		fcppt::cast::dynamic_cross_exn<
			awl::backends::windows::window::object &
		>(
			_window.awl_object()
		)
	),
	event_processor_(
		fcppt::cast::dynamic_exn<
			awl::backends::windows::window::event::processor &
		>(
			_window.awl_window_event_processor()
		)
	),
	system_processor_(
		fcppt::cast::dynamic_exn<
			awl::backends::windows::system::event::processor &
		>(
			_window_system.awl_system_event_processor()
		)
	),
	devices_(),
	event_handle_(
		system_processor_.create_event_handle()
	),
	has_focus_(
		false
	),
	keyboard_discover_(),
	keyboard_remove_(),
	mouse_discover_(),
	mouse_remove_(),
	joypad_discover_(),
	joypad_remove_(),
	init_message_(
		system_processor_
	),
	connections_(
		fcppt::assign::make_container<
			fcppt::signal::auto_connection_container
		>(
			event_processor_.register_callback(
				fcppt::strong_typedef_construct_cast<
					awl::backends::windows::message_type,
					fcppt::cast::to_unsigned_fun
				>(
					WM_SETFOCUS
				),
				awl::backends::windows::window::event::callback{
					std::bind(
						&sge::dinput::processor::on_focus_in,
						this,
						std::placeholders::_1
					)
				}
			),
			event_processor_.register_callback(
				fcppt::strong_typedef_construct_cast<
					awl::backends::windows::message_type,
					fcppt::cast::to_unsigned_fun
				>(
					WM_KILLFOCUS
				),
				awl::backends::windows::window::event::callback{
					std::bind(
						&sge::dinput::processor::on_focus_out,
						this,
						std::placeholders::_1
					)
				}
			),
			event_processor_.register_callback(
				init_message_.type(),
				awl::backends::windows::window::event::callback{
					std::bind(
						&sge::dinput::processor::on_init,
						this,
						std::placeholders::_1
					)
				}
			),
			system_processor_.register_handle_callback(
				awl::backends::windows::system::event::handle_callback{
					std::bind(
						&sge::dinput::processor::on_handle_ready,
						this
					)
				}
			)
		)
	)
{
	awl::backends::windows::post_message(
		windows_window_.hwnd(),
		init_message_.type(),
		awl::backends::windows::wparam(
			0u
		),
		awl::backends::windows::lparam(
			0
		)
	);
}