MCPcopy Create free account
hub / github.com/KLayout/klayout / send_mouse_release_event

Method send_mouse_release_event

src/laybasic/laybasic/layViewObject.cc:939–1003  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

937}
938
939void
940ViewObjectUI::send_mouse_release_event (const db::DPoint &pt, unsigned int buttons)
941{
942 try {
943
944 ensure_entered ();
945 begin_mouse_event ();
946
947 bool done = false;
948
949 // Qt does not include the released button in the mask, so we take the mouse buttons that we stored
950 // on "press", but use the current modifiers (issue #2214)
951 unsigned int effective_buttons = (m_mouse_buttons & lay::MouseButtonMask) | (buttons & lay::ModifierMask);
952
953 m_mouse_pos = pt;
954 db::DPoint p = pixel_to_um (m_mouse_pos);
955
956 auto grabbed = m_grabbed;
957 for (auto g = grabbed.begin (); !done && g != grabbed.end (); ++g) {
958 if (m_mouse_pressed_state) {
959 done = (*g)->enabled () && (*g)->mouse_click_event (p, effective_buttons, true);
960 } else {
961 done = (*g)->enabled () && (*g)->mouse_release_event (p, effective_buttons, true);
962 }
963 }
964
965 if (! done && mp_active_service && mp_active_service->enabled ()) {
966 if (m_mouse_pressed_state) {
967 done = mp_active_service->mouse_click_event (p, effective_buttons, true);
968 } else {
969 done = mp_active_service->mouse_release_event (p, effective_buttons, true);
970 }
971 }
972
973 service_iterator svc = begin_services ();
974 while (svc != end_services () && !done) {
975 service_iterator next = svc;
976 ++next;
977 if ((*svc)->enabled ()) {
978 if (m_mouse_pressed_state) {
979 done = (*svc)->mouse_click_event (p, effective_buttons, false);
980 } else {
981 done = (*svc)->mouse_release_event (p, effective_buttons, false);
982 }
983 }
984 svc = next;
985 }
986
987 if (! done) {
988 if (m_mouse_pressed_state) {
989 mouse_click_event (p, effective_buttons);
990 } else {
991 mouse_release_event (p, effective_buttons);
992 }
993 }
994
995 end_mouse_event ();
996

Callers 2

send_mouse_release_eventFunction · 0.80
mouseReleaseEventFunction · 0.80

Calls 8

begin_servicesFunction · 0.85
end_servicesFunction · 0.85
mouse_click_eventFunction · 0.70
mouse_release_eventFunction · 0.70
beginMethod · 0.45
endMethod · 0.45
mouse_click_eventMethod · 0.45
mouse_release_eventMethod · 0.45

Tested by

no test coverage detected