MCPcopy Create free account
hub / github.com/davisking/dlib / event_handler

Method event_handler

dlib/gui_core/gui_core_kernel_2.cpp:620–1242  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

618 // ----------------------------------------------------------------------------------------
619
620 void event_handler_thread::
621 event_handler (
622 )
623 /*!
624 ensures
625 - will handle all events and event dispatching
626 !*/
627 {
628 try
629 {
630 std::vector<unsigned char> bitmap_buffer;
631 bool quit_event_loop = false;
632 while (quit_event_loop == false)
633 {
634 // get a lock on the window_table's mutex
635 auto_mutex window_table_locker(window_table.get_mutex());
636
637 XEvent ev;
638 memset(&ev, 0, sizeof(ev));
639 while (XPending(disp) == 0){
640 window_table.get_mutex().unlock();
641 // wait until receiving X11 next event
642 struct pollfd pfd;
643 pfd.fd = ConnectionNumber(disp);
644 pfd.events = POLLIN | POLLPRI;
645 poll(&pfd, 1, -1);
646
647 window_table.get_mutex().lock();
648 }
649 XNextEvent(disp,&ev);
650
651 // pass events to input method.
652 // if this event is needed by input method, XFilterEvent returns True
653 if (XFilterEvent(&ev, None) == True){
654 continue;
655 }
656
657 // if this event is for one of the windows in the window_table
658 // then get that window out of the table and put it into win.
659 XAnyEvent* _ae = reinterpret_cast<XAnyEvent*>(&ev);
660 base_window** win_ = window_table[_ae->window];
661 base_window* win = 0;
662 if (win_)
663 win = *win_;
664
665
666 // ignore messages for unmapped windows
667 if (ev.type != MapNotify && win != 0)
668 {
669 if (win->is_mapped == false)
670 continue;
671 }
672
673
674 switch (ev.type)
675 {
676
677 case SelectionRequest:

Callers

nothing calls this directly

Calls 15

absFunction · 0.85
paintMethod · 0.80
map_keysFunction · 0.70
unlockMethod · 0.45
lockMethod · 0.45
sizeMethod · 0.45
on_window_resizedMethod · 0.45
on_window_movedMethod · 0.45
resizeMethod · 0.45
on_string_putMethod · 0.45
on_keydownMethod · 0.45

Tested by

no test coverage detected