org.gnu.gdk

Class Display

public class Display extends GObject

Display objects are the GDK representation of the X Display which can be described as a workstation consisting of a keyboard a pointing device (such as a mouse) and one or more screens. It is used to open and keep track of various Screen objects currently instanciated by the application. It is also used to grab and release the keyboard and the mouse pointer.
Constructor Summary
Display()
Creates the default Display.
Display(String name)
Creates the named display
Display(Handle hndl)
Method Summary
voidbeep()
Emits a short beep on display.
voidclose()
Closes the connection to the windowing system for this display and cleans up associated resources.
voidflush()
Flushes any requests queued for the windowing system; this happens automatically when the main loop block waiting for events, but if your application is drawing without returning control to the main loop, you may need to call this method explicitely.
DevicegetCorePointer()
Returns the core pointer device for this display.
intgetDefaultCursorSize()
Returns the default size to use for cursors on display.
WindowgetDefaultGroup()
Returns the default group leader window for all toplevel windows on display.
ScreengetDefaultScreen()
Gets the default Screen for display.
static DisplaygetDisplayFromHandle(Handle hndl)
Create a new Display from a handle to a native resource.
EventgetEvent()
Gets the next event to be processed by the display, fetching events from the windowing system if necessary.
intgetMaxCursorHeight()
Return the maximum height for a cursor on display.
intgetMaxCursorWidth()
Return the maximum width for a cursor on display.
StringgetName()
Gets the name of the Display.
intgetNumScreens()
Gets the number of Screens managed by the Display.
PointgetPointerLocation()
Returns the point where the pointer is currently pointing.
ScreengetPointerScreen()
Returns the screen that the pointer is on.
ScreengetScreen(int screenNumber)
Gets the a Screen object for one of the screens of the display.
TypegetType()
WindowgetWindowAtPointer()
Obtains the window underneath the mouse pointer.
Device[]listDevice()
Returns an array of available input devices attached to this display.
static Displayopen(String name)
Opens a Display.
EventpeekEvent()
Gets a copy of the first event in the display's event queue without removing the event from the queue.
booleanpointerIsGrabbed()
Tests if the pointer is grabbed.
voidputEvent(Event anEvent)
Appends a copy of a given event onto the front of the event queue for the display.
booleanrequestSelectionNotification(Atom atom)
Requests EventOwnerChange events for ownership changes of the selection named by the given atom.
voidsetDoubleClickDistance(int distance)
Sets the double click distance (two clicks within this distance count as a double click).
voidsetDoubleClickTime(int msec)
Set the double click time (two clicks within this time interval count as a double click).
voidstoreClipboard(Window clipboardWindow, Atom[] targets)
Issues a request to the clipboard manager to store the clipboard data.
booleansupportsClipboardPersistence()
Returns whether the display supports clipboard persistence; i.e. if it is possible to store the clipboard data after an application has quit.
booleansupportsCursorAlpha()
Returns true if the cursor can use an 8bit alpha channel on display.
booleansupportsCursorColor()
Returns true if multicolored cursors are supported on the display.
booleansupportsSelectionNotification()
Returns whether EventOwnerChange events will be sent when the owner of a selection changes.
voidsync()
Flushes any requests queued for the windowing system and waits until all requests are handled.
voidungrabKeyboard()
Releases any keyboard grab.
voidungrabPointer()
Releases any pointer grab.
voidwarpPointer(Screen screen, int x, int y)

Constructor Detail

Display

public Display()
Creates the default Display.

Display

public Display(String name)
Creates the named display

Parameters: name The name of the display to open

Display

public Display(Handle hndl)

Method Detail

beep

public void beep()
Emits a short beep on display.

close

public void close()
Closes the connection to the windowing system for this display and cleans up associated resources.

flush

public void flush()
Flushes any requests queued for the windowing system; this happens automatically when the main loop block waiting for events, but if your application is drawing without returning control to the main loop, you may need to call this method explicitely. A common case where this method needs to be called is when an application is executing drawing commands from a thread other than the thread where the main loop is running.

getCorePointer

public Device getCorePointer()
Returns the core pointer device for this display.

getDefaultCursorSize

public int getDefaultCursorSize()
Returns the default size to use for cursors on display.

getDefaultGroup

public Window getDefaultGroup()
Returns the default group leader window for all toplevel windows on display.

getDefaultScreen

public Screen getDefaultScreen()
Gets the default Screen for display.

getDisplayFromHandle

public static Display getDisplayFromHandle(Handle hndl)
Create a new Display from a handle to a native resource. Should only be used internally by Java-Gnome.

getEvent

public Event getEvent()
Gets the next event to be processed by the display, fetching events from the windowing system if necessary.

getMaxCursorHeight

public int getMaxCursorHeight()
Return the maximum height for a cursor on display.

getMaxCursorWidth

public int getMaxCursorWidth()
Return the maximum width for a cursor on display.

getName

public String getName()
Gets the name of the Display.

getNumScreens

public int getNumScreens()
Gets the number of Screens managed by the Display.

getPointerLocation

public Point getPointerLocation()
Returns the point where the pointer is currently pointing.

getPointerScreen

public Screen getPointerScreen()
Returns the screen that the pointer is on.

getScreen

public Screen getScreen(int screenNumber)
Gets the a Screen object for one of the screens of the display.

Parameters: screenNumber

getType

public Type getType()

getWindowAtPointer

public Window getWindowAtPointer()
Obtains the window underneath the mouse pointer.

listDevice

public Device[] listDevice()
Returns an array of available input devices attached to this display.

open

public static Display open(String name)

Deprecated:

Opens a Display.

Parameters: name

peekEvent

public Event peekEvent()
Gets a copy of the first event in the display's event queue without removing the event from the queue.

pointerIsGrabbed

public boolean pointerIsGrabbed()
Tests if the pointer is grabbed.

putEvent

public void putEvent(Event anEvent)
Appends a copy of a given event onto the front of the event queue for the display.

Parameters: anEvent

requestSelectionNotification

public boolean requestSelectionNotification(Atom atom)
Requests EventOwnerChange events for ownership changes of the selection named by the given atom.

Parameters: atom

setDoubleClickDistance

public void setDoubleClickDistance(int distance)
Sets the double click distance (two clicks within this distance count as a double click). Applications should not set this, it is a global user-configured setting.

Parameters: distance

setDoubleClickTime

public void setDoubleClickTime(int msec)
Set the double click time (two clicks within this time interval count as a double click). Applications should not set this, it is a global user-configured setting.

Parameters: msec

storeClipboard

public void storeClipboard(Window clipboardWindow, Atom[] targets)
Issues a request to the clipboard manager to store the clipboard data.

Parameters: clipboardWindow targets

supportsClipboardPersistence

public boolean supportsClipboardPersistence()
Returns whether the display supports clipboard persistence; i.e. if it is possible to store the clipboard data after an application has quit.

supportsCursorAlpha

public boolean supportsCursorAlpha()
Returns true if the cursor can use an 8bit alpha channel on display.

supportsCursorColor

public boolean supportsCursorColor()
Returns true if multicolored cursors are supported on the display.

supportsSelectionNotification

public boolean supportsSelectionNotification()
Returns whether EventOwnerChange events will be sent when the owner of a selection changes.

sync

public void sync()
Flushes any requests queued for the windowing system and waits until all requests are handled. This is often used for making sure that the display is synchronized with the current state of the program.

ungrabKeyboard

public void ungrabKeyboard()
Releases any keyboard grab.

ungrabPointer

public void ungrabPointer()
Releases any pointer grab.

warpPointer

public void warpPointer(Screen screen, int x, int y)