OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [gnu/] [gcj/] [xlib/] [Display.java] - Blame information for rev 756

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 756 jeremybenn
/* Copyright (C) 1999, 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 java.util.Dictionary;
12
import java.util.Hashtable;
13
import java.util.Vector;
14
import java.util.Enumeration;
15
 
16
import gnu.gcj.RawData;
17
 
18
/**
19
 * A connection to an X11 display.
20
 *
21
 * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
22
 */
23
 
24
public class Display
25
{
26
  static
27
  {
28
    staticInit();
29
  }
30
 
31
  public Display()
32
  {
33
    init();
34
  }
35
 
36
  private static native void staticInit();
37
  private native void init();
38
  protected native void finalize();
39
 
40
  RawData display = null;
41
 
42
  /* TODO?: Rather than storing such data here, we might consider
43
     using the context manager facilities provided by Xlib... */
44
  private Dictionary xids = new Hashtable();
45
 
46
  protected final void addXID(int xid, XID window)
47
  {
48
    xids.put(new Integer(xid), window);
49
  }
50
 
51
  protected final void removeXID(int xid)
52
  {
53
    xids.remove(new Integer(xid));
54
  }
55
 
56
  public final Window getDefaultRootWindow()
57
  {
58
    int rootXID = getDefaultRootWindowXID();
59
    return getWindow(rootXID);
60
  }
61
 
62
  public final XID getXID(int xid)
63
  {
64
    return (XID) xids.get(new Integer(xid));
65
  }
66
 
67
  public final Window getWindow(int xid)
68
  {
69
    Window window = (Window) getXID(xid);
70
    if (window == null)
71
      {
72
        window = new Window(this, xid);
73
        addXID(xid, window);
74
      }
75
    return window;
76
  }
77
 
78
  public final Screen getDefaultScreen()
79
  {
80
    /* Screens objects are not cached since they are lightweight.
81
       We just create a new object when requested. */
82
    return new Screen(this, getDefaultScreenNumber());
83
  }
84
 
85
  public final native int getDefaultScreenNumber();
86
 
87
  private final native int getDefaultRootWindowXID();
88
 
89
  private Dictionary atoms = new Hashtable();
90
 
91
  public final int getAtom(String name)
92
  {
93
    Integer atomInt = (Integer) atoms.get(name);
94
    if (atomInt == null)
95
      return internAtom(name);
96
    return atomInt.intValue();
97
  }
98
 
99
  // TODO?: cache reverse lookup too?
100
  public final native String getAtomName(int atom);
101
 
102
  private final native int internAtom(String name);
103
 
104
  public native void flush();
105
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.