Source for gnu.gcj.xlib.XAnyEvent

   1: /* Copyright (C) 2000  Free Software Foundation
   2: 
   3:    This file is part of libgcj.
   4: 
   5: This software is copyrighted work licensed under the terms of the
   6: Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
   7: details.  */
   8: 
   9: package gnu.gcj.xlib;
  10: 
  11: import gnu.gcj.RawData;
  12: 
  13: /** 
  14:  * Mutable event structure that can contain any data from any event
  15:  * type.  Events can be constructed or loaded from the event queue.
  16:  *
  17:  * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
  18:  */
  19: public final class XAnyEvent
  20: {
  21:   // Must match the definitions in X.h:
  22:   public static final int 
  23:                       TYPE_KEY_PRESS          =  2,
  24:                       TYPE_KEY_RELEASE        =  3,
  25:                       TYPE_BUTTON_PRESS       =  4,
  26:                       TYPE_BUTTON_RELEASE     =  5,
  27:                       TYPE_MOTION_NOTIFY      =  6,
  28:                       TYPE_ENTER_NOTIFY       =  7,
  29:                       TYPE_LEAVE_NOTIFY       =  8,
  30:                       TYPE_FOCUS_IN           =  9,
  31:                       TYPE_FOCUS_OUT          = 10,
  32:                       TYPE_KEYMAP_NOTIFY      = 11,
  33:                       TYPE_EXPOSE             = 12,
  34:                       TYPE_GRAPHICS_EXPOSE    = 13,
  35:                       TYPE_NO_EXPOSE          = 14,
  36:                       TYPE_VISIBILITY_NOTIFY  = 15,
  37:                       TYPE_CREATE_NOTIFY      = 16,
  38:                       TYPE_DESTROY_NOTIFY     = 17,
  39:                       TYPE_UNMAP_NOTIFY       = 18,
  40:                       TYPE_MAP_NOTIFY         = 19,
  41:                       TYPE_MAP_REQUEST        = 20,
  42:                       TYPE_REPARENT_NOTIFY    = 21,
  43:                       TYPE_CONFIGURE_NOTIFY   = 22,
  44:                       TYPE_CONFIGURE_REQUEST  = 23,
  45:                       TYPE_GRAVITY_NOTIFY     = 24,
  46:                       TYPE_RESIZE_REQUEST     = 25,
  47:                       TYPE_CIRCULATE_NOTIFY   = 26,
  48:                       TYPE_CIRCULATE_REQUEST  = 27,
  49:                       TYPE_PROPERTY_NOTIFY    = 28,
  50:                       TYPE_SELECTION_CLEAR    = 29,
  51:                       TYPE_SELECTION_REQUEST  = 30,
  52:                       TYPE_SELECTION_NOTIFY   = 31,
  53:                       TYPE_COLORMAP_NOTIFY    = 32,
  54:                       TYPE_CLIENT_MESSAGE     = 33,
  55:                       TYPE_MAPPING_NOTIFY     = 34;
  56:     
  57:   // Must match the definitions in X.h:
  58:   public final static long MASK_SUBSTRUCTURE_NOTIFY   = 1L<<19,
  59:                        MASK_SUBSTRUCTURE_REDIRECT = 1L<<20;
  60: 
  61:   public XAnyEvent(Display display)
  62:   {
  63:     this.display = display;
  64:     init();
  65:   }
  66: 
  67:   private native void init();
  68:   protected native void finalize();
  69: 
  70:   /**
  71:    * Load next event into the event structure.
  72:    */
  73:   public native boolean loadNext(boolean block);
  74:   public native void interrupt();
  75: 
  76:   public native int getType();
  77:   public native void setType(int type);
  78: 
  79:   public native Window getWindow();
  80:   public native void setWindow(Window window);
  81:   
  82:   /**
  83:    * @returns the number of the last request processed by the server.
  84:    */
  85:   public native long getSerial();
  86: 
  87:   public native void send(Window destination, boolean propagate,
  88:               long mask);
  89: 
  90:   RawData pipefds;
  91:   RawData structure;
  92:   Display display;
  93: 
  94:   public String toString()
  95:   {
  96:     if (structure == null)
  97:       return getClass().getName() + "[no-structure]";
  98: 
  99:     return getClass().getName() +
 100:       "[type=" + getType() +
 101:       ",window=" + getWindow() + "]";
 102:   }
 103: }