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 TYPE_BUTTON_PRESS = 4,
|
---|
23 | TYPE_BUTTON_RELEASE = 5,
|
---|
24 | TYPE_EXPOSE = 12,
|
---|
25 | TYPE_UNMAP_NOTIFY = 18,
|
---|
26 | TYPE_MAP_NOTIFY = 19,
|
---|
27 | TYPE_REPARENT_NOTIFY = 21,
|
---|
28 | TYPE_CONFIGURE_NOTIFY = 22,
|
---|
29 | TYPE_CLIENT_MESSAGE = 33;
|
---|
30 |
|
---|
31 | // Must match the definitions in X.h:
|
---|
32 | public final static long MASK_SUBSTRUCTURE_NOTIFY = 1L<<19,
|
---|
33 | MASK_SUBSTRUCTURE_REDIRECT = 1L<<20;
|
---|
34 |
|
---|
35 | XAnyEvent(Display display)
|
---|
36 | {
|
---|
37 | this.display = display;
|
---|
38 | init();
|
---|
39 | }
|
---|
40 |
|
---|
41 | private native void init();
|
---|
42 | protected native void finalize();
|
---|
43 |
|
---|
44 | /**
|
---|
45 | * Load next event into the event structure.
|
---|
46 | */
|
---|
47 | public native void loadNext();
|
---|
48 |
|
---|
49 | public native int getType();
|
---|
50 | public native void setType(int type);
|
---|
51 |
|
---|
52 | public native Window getWindow();
|
---|
53 | public native void setWindow(Window window);
|
---|
54 |
|
---|
55 | /**
|
---|
56 | * @returns the number of the last request processed by the server.
|
---|
57 | */
|
---|
58 | public native long getSerial();
|
---|
59 |
|
---|
60 | public native void send(Window destination, boolean propagate,
|
---|
61 | long mask);
|
---|
62 |
|
---|
63 | RawData structure;
|
---|
64 | Display display;
|
---|
65 |
|
---|
66 | public String toString()
|
---|
67 | {
|
---|
68 | if (structure == null)
|
---|
69 | return getClass().getName() + "[no-structure]";
|
---|
70 |
|
---|
71 | return getClass().getName() +
|
---|
72 | "[type=" + getType() +
|
---|
73 | ",window=" + getWindow() + "]";
|
---|
74 | }
|
---|
75 | }
|
---|