Source for gnu.gcj.xlib.XButtonEvent

   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: /**
  12:  * Interprets data from an Xlib XButtonEvent into members of java
  13:  * primitive types.
  14:  *
  15:  * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
  16:  */
  17: public class XButtonEvent extends XEvent
  18: {
  19: 
  20:   // Must match the definition in X.h:
  21:   public static final int MASK_SHIFT   = 1<<0,
  22:                           MASK_LOCK    = 1<<1,
  23:                           MASK_CONTROL = 1<<2,
  24:                           MASK_MOD1    = 1<<3,
  25:                           MASK_MOD2    = 1<<4,
  26:                           MASK_MOD3    = 1<<5,
  27:                           MASK_MOD4    = 1<<6,
  28:                           MASK_MOD5    = 1<<7;
  29:  
  30:   public XButtonEvent(XAnyEvent event)
  31:   {
  32:     super(event);
  33: 
  34:     // FIXME: Avoid double checking?
  35:     if ((event.getType() != XAnyEvent.TYPE_BUTTON_PRESS) &&
  36:     (event.getType() != XAnyEvent.TYPE_BUTTON_RELEASE))
  37:       {
  38:     throw new IllegalArgumentException("Wrong event type");
  39:       }
  40:     init();
  41:   }
  42: 
  43:   native void init();
  44:   
  45:   public long time;
  46:   public int  x;
  47:   public int  y;
  48:   public int  state;
  49:   public int  button;
  50: }
  51: 
  52: