void PlatformApiStub::update_window_state(const WindowStateUpdate &state) { protobuf::bridge::EventSequence seq; auto event = seq.mutable_window_state_update(); auto convert_window = [](WindowStateUpdate::Window in, anbox::protobuf::bridge::WindowStateUpdateEvent_WindowState *out) { out->set_display_id(in.display_id); out->set_has_surface(in.has_surface); out->set_package_name(in.package_name); out->set_frame_left(in.frame.left); out->set_frame_top(in.frame.top); out->set_frame_right(in.frame.right); out->set_frame_bottom(in.frame.bottom); out->set_task_id(in.task_id); out->set_stack_id(in.stack_id); }; for (const auto &window : state.updated_windows) { auto w = event->add_windows(); convert_window(window, w); } for (const auto &window : state.removed_windows) { auto w = event->add_removed_windows(); convert_window(window, w); } rpc_channel_->send_event(seq); }
static void do_tests(void) { #if 0 arched_opening(50, 20, 10); #endif #if 0 crenelation(10, 20); #endif #if 0 add_windows(20, 100); #endif #if 0 generic_tower(0, 0, 20, 100, irandomn(100) < 50); #endif #if 0 wall(-200, -200, 200, 200, 20, 100); #endif #if 0 gothic_arch(10, 20, 5); #endif #if 0 gothic_arch_array(100, 5, 20, 5, 4); #endif #if 0 gothic_matrix(100, 50, 75, 4, 2, 4); #endif #if 0 gabled_roof(100, 50, 50); #endif #if 0 crenelation_matrix(50, 100, 10, 7); #endif #if 0 crenelated_rectangle(50, 100, 50, 10, 7); #endif #if 0 fancy_roof(50, 150, 60); #endif #if 0 auto_gothic_hall(300, 150, 75, 1); #endif #if 0 english_house(75, 150, 125, 50); #endif #if 0 buttressed_foundation(100, 200, 50, 8, 15); #endif #if 0 keep_block(100, 200, 100); #endif #if 0 enclosure(5, 200, 100); #endif #if 0 recursive_keep(0, 0, 200, 350, 50, 4); #endif }
static void pointy_tower(double x, double y, double r, double h, int flying, double fa) { double pointiness; pointiness = perturbup(1.4, 0.5); int extra_pointy; /* prevent > 45 degree overhangs to maintain 3d-printability */ if (r > h * 0.20) flying = 0; extra_pointy = (r < h * 0.30 && irandomn(100) < 40); xlate(x, y, 0); /* xlate(0, 0, h * 0.8); */ diff(); onion(); if (flying) { angular_cylinder(h * 0.75, 0.15 * r, 0.15 * r, fa); xlate(0, 0, h * 0.5); angular_cylinder(h * 0.25, 0.10 * r, r * 1.2, fa); xlate(0, 0, h * 0.25); angular_cylinder(1.6 * r, 1.2 * r, r * 1.2, fa); xlate(0, 0, r * 1.6); angular_cylinder(pointiness * r, 1.2 * r, 0, fa); if (extra_pointy) angular_cylinder(pointiness * 2 * r, 0.6 * r, 0, fa); } else { angular_cylinder(h, r, 0.80 * r, fa); xlate(0, 0, h - 0.6 * r); angular_cylinder(0.6 * r, 0.81 * r, r * 1.2, fa); xlate(0, 0, r * 0.6); angular_cylinder(0.6 * r, 1.2 * r, r * 1.2, fa); xlate(0, 0, r * 0.6); angular_cylinder(pointiness * r, 1.2 * r, 0, fa); if (extra_pointy) angular_cylinder(pointiness * 2 * r, 0.6 * r, 0, fa); } endxlate(); endxlate(); endxlate(); endonion(); if (!flying) { add_windows(r, h); } if (!flying) xlate(0, 0, h + 3); else xlate(0, 0, h * 0.85); crenelation(r * 1.2, r * 2); endxlate(); enddiff(); endxlate(); }
static void angular_tower(double x, double y, double r, double h, int flying, double fa) { xlate(x, y, 0); /* prevent > 45 degree overhangs to maintain 3d-printability */ if (r > h * 0.20) flying = 0; if (!flying) diff(); onion(); if (flying) { angular_cylinder(h * 0.75, r * 0.15, 0.15 * r, fa); xlate(0, 0, h * 0.50); angular_cylinder(h * 0.25, 0.10 * r, r * 1.2, fa); xlate(0, 0, h * 0.25); diff(); angular_cylinder(1.6 * r, 1.2 * r, r * 1.2, fa); xlate(0, 0, 0.80 * r); angular_cylinder(1.00 * r, 1.0 * r, r * 1.0, fa); xlate(0, 0, 0.7 * r); crenelation(2.3 * r, r * 2.0); endxlate(); } else { angular_cylinder(h, r, 0.80 * r, fa); xlate(0, 0, h - 0.6 * r); angular_cylinder(0.6 * r, 0.81 * r, r * 1.2, fa); xlate(0, 0, r * 0.6); diff(); angular_cylinder(0.6 * r, 1.2 * r, r * 1.2, fa); angular_cylinder(0.75 * r, 1.0 * r, r * 1.0, fa); xlate(0, 0, 0.7 * r); crenelation(2.3 * r, r * 2.0); } endxlate(); enddiff(); endxlate(); endxlate(); endonion(); if (!flying) { add_windows(r, h); enddiff(); } endxlate(); }