예제 #1
0
        protected virtual void dispatch_event()
        {
            evt = display.next_event ();

            switch (evt.code ()) {
            case gnu.x11.xevent.ButtonPress.CODE:
              exit ();
              break;

            case ClientMessage.CODE:
              if (((ClientMessage) evt).delete_window ()) exit ();
              break;

            case Expose.CODE:
              if (((Expose) evt).count () == 0) paint ();
              break;

            case KeyPress.CODE: {
              KeyPress e = (KeyPress) evt;

              int keycode = e.detail ();
              int keystate = e.state ();
              int keysym = display.input.keycode_to_keysym (keycode, keystate);

              if (keysym == 'q' || keysym == 'Q'
            || keysym == gnu.x11.keysym.Misc.ESCAPE) exit ();
              break;
            }
            }
        }
예제 #2
0
파일: Window.cs 프로젝트: jbnivoit/projects
     // opcode 25 - send event
     /**
        * @see <a href="XSendEvent.html">XSendEvent</a>
        */
     public void send_event(bool propagate, int event_mask, 
 Event evt)
     {
         Request request = new Request (display, 25, propagate, 11);
         request.write4 (id);
         request.write4 (event_mask);
         request.write1 (evt.data);
         display.send_request (request);
     }
예제 #3
0
 protected virtual bool handle_event(Event evt)
 {
     error ();
     return false;
 }
예제 #4
0
        private void dispatch_event()
        {
            evt = display.next_event ();
            if ((event_mask & EVENT_BIT) != 0 && handle_event (evt)) return;

            switch (evt.code ()) {
            case ButtonPress.CODE: dispatch_button_press (); break;
            case ClientMessage.CODE: dispatch_client_message (); break;
            case ConfigureNotify.CODE: dispatch_configure_notify (); break;
            case Expose.CODE: dispatch_expose (); break;
            case KeyPress.CODE: dispatch_key_press (); break;
            case MotionNotify.CODE: dispatch_motion_notify (); break;
            }
        }
예제 #5
0
파일: Puppet.cs 프로젝트: jbnivoit/projects
        public void when(Event evt)
        {
            if (print_event) Console.WriteLine (evt);

            switch (evt.code ()) {
            case ButtonPress.CODE:
              when_button_press ((ButtonPress) evt);
              break;

            case ClientMessage.CODE: // un-avoidable
              when_client_message ((ClientMessage) evt);
              break;

            case ConfigureRequest.CODE: // Event.SUBSTRUCTURE_NOTIFY
              when_configure_request ((ConfigureRequest) evt);
              break;

            case DestroyNotify.CODE: // Event.SUBSTRUCTURE_NOTIFY
              when_destroy_notify ((DestroyNotify) evt);
              break;

            case KeyPress.CODE:	// grab key
              when_key_press ((KeyPress) evt);
              break;

            case KeyRelease.CODE:	// grab key
              when_key_release ((KeyRelease) evt);
              break;

            case PropertyNotify.CODE: // Event.PROPERTY_CHANGE
              when_property_notify ((PropertyNotify) evt);
              break;

            case MapRequest.CODE:	// Event.SUBSTRUCTURE_REDIRECT
              when_map_request ((MapRequest) evt);
              break;

            case MapNotify.CODE:	// Event.SUBSTRUCTURE_NOTIFY
              when_map_notify ((MapNotify) evt);
              break;

            case UnmapNotify.CODE:	 // Event.SUBSTRUCTURE_NOTIFY
              when_unmap_notify ((UnmapNotify) evt);
              break;

            case ConfigureNotify.CODE: // Event.SUBSTRUCTURE_NOTIFY, ignored
            case CreateNotify.CODE: // Event.SUBSTRUCTURE_NOTIFY, ignored
            case MappingNotify.CODE: // un-avoidable, ignored TODO
              break;

            default:
              alert_user ("Unhandled event: " + evt);
            break;
            }
        }