#include <linux/input.h>
#include <iostream>
namespace
{
{
std::cout << "Handling key event (time, scancode, keycode): " << event_time << " " <<
scan_code << " " << key_code << std::endl;
}
{
std::cout << "Handline touch event time=" << event_time
<< " touch_count=" << tc << std::endl;
for (unsigned i = 0; i < tc; i++)
{
std::cout << " "
<< " id=" << id
<< " pos=(" << px << ", " << py << ")"
<< std::endl;
}
std::cout << "----------------" << std::endl << std::endl;
}
{
{
return false;
{
print_key_event(input_event);
break;
print_touch_event(input_event);
break;
default:
abort();
}
return false;
}
};
{
{
return false;
return false;
}
{
static const int modifier_mask =
{
switch (scan_code)
{
case KEY_UP:
break;
case KEY_DOWN:
break;
case KEY_LEFT:
break;
case KEY_RIGHT:
break;
default:
return false;
}
return true;
}
return false;
}
{
compositor->stop();
auto conf = display->configuration();
{
});
display->configure(*conf);
compositor->start();
}
std::shared_ptr<mg::Display> display;
std::shared_ptr<mc::Compositor> compositor;
};
}
-> std::shared_ptr<mi::EventFilter>
{
static const char* const print_input_events = "print-input-events";
static const char* const print_input_events_descr = "List input events on std::cout";
auto const printing_filter = std::make_shared<PrintingEventFilter>();
server.add_init_callback([printing_filter, &server]
{
const auto options = server.get_options();
if (options->is_set(print_input_events))
server.the_composite_event_filter()->prepend(printing_filter);
});
return printing_filter;
}
-> std::shared_ptr<input::EventFilter>
{
static const char* const screen_rotation = "screen-rotation";
static const char* const screen_rotation_descr = "Rotate screen on Ctrl-Alt-<Arrow>";
auto const screen_rotation_filter = std::make_shared<ScreenRotationFilter>();
server.add_init_callback([screen_rotation_filter, &server]
{
const auto options = server.get_options();
if (options->is_set(screen_rotation))
{
screen_rotation_filter->display = server.the_display();
screen_rotation_filter->compositor = server.the_compositor();
server.the_composite_event_filter()->prepend(screen_rotation_filter);
}
});
return screen_rotation_filter;
}