├── .gitignore
├── .gitmodules
├── .travis.yml
├── README.md
├── bootstrap
├── .gitignore
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── org
│ │ └── trinity
│ │ └── bootstrap
│ │ └── EntryPoint.java
│ └── resources
│ └── logback.xml
├── eclipsesettings
├── codestyle-cleanup.xml
├── codestyle-codetemplates.xml
└── codestyle-formatting.xml
├── foundation
├── .gitignore
├── api
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ └── java
│ │ │ └── org
│ │ │ └── trinity
│ │ │ └── foundation
│ │ │ └── api
│ │ │ ├── display
│ │ │ ├── Display.java
│ │ │ ├── DisplayArea.java
│ │ │ ├── DisplayAreaManipulator.java
│ │ │ ├── DisplaySurface.java
│ │ │ ├── DisplaySurfaceFactory.java
│ │ │ ├── DisplaySurfaceHandle.java
│ │ │ ├── Module.java
│ │ │ ├── Screen.java
│ │ │ ├── bindkey
│ │ │ │ └── DisplayExecutor.java
│ │ │ ├── event
│ │ │ │ ├── CreationNotify.java
│ │ │ │ ├── DestroyNotify.java
│ │ │ │ ├── DisplayEvent.java
│ │ │ │ ├── FocusGainNotify.java
│ │ │ │ ├── FocusLostNotify.java
│ │ │ │ ├── FocusNotify.java
│ │ │ │ ├── GeometryNotify.java
│ │ │ │ ├── GeometryRequest.java
│ │ │ │ ├── HideNotify.java
│ │ │ │ ├── PointerEnterNotify.java
│ │ │ │ ├── PointerLeaveNotify.java
│ │ │ │ ├── PointerVisitationNotify.java
│ │ │ │ ├── ShowNotify.java
│ │ │ │ ├── ShowRequest.java
│ │ │ │ ├── StackingChangedNotify.java
│ │ │ │ └── package-info.java
│ │ │ └── package-info.java
│ │ │ ├── render
│ │ │ ├── Painter.java
│ │ │ ├── PainterFactory.java
│ │ │ ├── binding
│ │ │ │ ├── Binder.java
│ │ │ │ ├── model
│ │ │ │ │ ├── PropertyChanged.java
│ │ │ │ │ └── ViewReference.java
│ │ │ │ ├── package-info.java
│ │ │ │ └── view
│ │ │ │ │ ├── DataContext.java
│ │ │ │ │ ├── DefaultPropertyAdapter.java
│ │ │ │ │ ├── EventSignal.java
│ │ │ │ │ ├── EventSignalFilter.java
│ │ │ │ │ ├── EventSignals.java
│ │ │ │ │ ├── ObservableCollection.java
│ │ │ │ │ ├── PropertyAdapter.java
│ │ │ │ │ ├── PropertySlot.java
│ │ │ │ │ ├── PropertySlots.java
│ │ │ │ │ ├── delegate
│ │ │ │ │ ├── ChildViewDelegate.java
│ │ │ │ │ ├── PropertySlotInvocatorDelegate.java
│ │ │ │ │ ├── Signal.java
│ │ │ │ │ └── package-info.java
│ │ │ │ │ └── package-info.java
│ │ │ ├── bindkey
│ │ │ │ └── RenderExecutor.java
│ │ │ └── package-info.java
│ │ │ └── shared
│ │ │ ├── AsyncListenable.java
│ │ │ ├── AsyncListenableEventBus.java
│ │ │ ├── Coordinate.java
│ │ │ ├── ExecutionContext.java
│ │ │ ├── ImmutableRectangle.java
│ │ │ ├── Margins.java
│ │ │ ├── Rectangle.java
│ │ │ ├── Size.java
│ │ │ └── package-info.java
│ │ └── test
│ │ └── java
│ │ └── org
│ │ └── trinity
│ │ └── foundation
│ │ └── api
│ │ └── shared
│ │ └── AsyncListenableEventBusTest.java
├── display.x11.api
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ └── java
│ │ └── org
│ │ └── trinity
│ │ └── foundation
│ │ └── display
│ │ └── x11
│ │ └── api
│ │ ├── Module.java
│ │ ├── XConnection.java
│ │ ├── XEventHandler.java
│ │ ├── XScreen.java
│ │ ├── XWindowCache.java
│ │ ├── XcbErrorUtil.java
│ │ └── bindkey
│ │ └── XEventBus.java
├── display.x11.impl
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ └── java
│ │ │ └── org
│ │ │ └── trinity
│ │ │ └── foundation
│ │ │ └── display
│ │ │ └── x11
│ │ │ └── impl
│ │ │ ├── Module.java
│ │ │ ├── XConnectionImpl.java
│ │ │ ├── XDisplayImpl.java
│ │ │ ├── XEventHandlers.java
│ │ │ ├── XEventPump.java
│ │ │ ├── XScreenImpl.java
│ │ │ ├── XTime.java
│ │ │ ├── XWindow.java
│ │ │ ├── XWindowCacheImpl.java
│ │ │ ├── XWindowHandle.java
│ │ │ └── event
│ │ │ ├── CirculateNotifyHandler.java
│ │ │ ├── ConfigureNotifyHandler.java
│ │ │ ├── ConfigureRequestHandler.java
│ │ │ ├── DestroyNotifyHandler.java
│ │ │ ├── EnterNotifyHandler.java
│ │ │ ├── FocusInHandler.java
│ │ │ ├── FocusOutHandler.java
│ │ │ ├── GenericErrorHandler.java
│ │ │ ├── LeaveNotifyHandler.java
│ │ │ ├── MapNotifyHandler.java
│ │ │ ├── MapRequestHandler.java
│ │ │ └── UnmapNotifyHandler.java
│ │ └── test
│ │ └── java
│ │ └── org
│ │ └── trinity
│ │ └── foundation
│ │ └── display
│ │ └── x11
│ │ └── impl
│ │ └── XWindowTest.java
├── pom.xml
├── render.binding.impl
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ └── java
│ │ │ └── org
│ │ │ └── trinity
│ │ │ └── foundation
│ │ │ └── api
│ │ │ └── render
│ │ │ └── binding
│ │ │ ├── BinderImpl.java
│ │ │ ├── Module.java
│ │ │ ├── PropertyChangedSignalDispatcher.java
│ │ │ └── SignalImpl.java
│ │ └── test
│ │ └── java
│ │ └── org
│ │ └── trinity
│ │ └── foundation
│ │ └── api
│ │ └── render
│ │ └── binding
│ │ ├── BooleanToStringAdapter.java
│ │ ├── CollectionElementView.java
│ │ ├── DataContextTest.java
│ │ ├── DummyExecutor.java
│ │ ├── DummySubModel.java
│ │ ├── DummySubSubModel.java
│ │ ├── InputSlotBindingTest.java
│ │ ├── Model.java
│ │ ├── ObservableCollectionBindingTest.java
│ │ ├── PropertyBindingTest.java
│ │ ├── SubView.java
│ │ └── View.java
└── render.qt.impl
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ ├── main
│ └── java
│ │ └── org
│ │ └── trinity
│ │ └── foundation
│ │ └── render
│ │ └── qt
│ │ └── impl
│ │ ├── RenderApplication.java
│ │ ├── RenderDisplaySurfaceHandle.java
│ │ ├── RenderEventConversion.java
│ │ ├── RenderEventConverter.java
│ │ ├── binding
│ │ └── view
│ │ │ └── delegate
│ │ │ ├── ChildViewDelegateImpl.java
│ │ │ └── PropertySlotInvocatorDelegateImpl.java
│ │ ├── eventconverters
│ │ ├── DestroyConversion.java
│ │ ├── FocusGainConversion.java
│ │ ├── FocusLostConversion.java
│ │ ├── MouseEnterConversion.java
│ │ └── MouseLeaveConversion.java
│ │ └── painter
│ │ ├── Module.java
│ │ ├── PainterImpl.java
│ │ ├── ViewDiscovery.java
│ │ ├── ViewEventTracker.java
│ │ └── ViewEventTrackerFactory.java
│ └── test
│ └── java
│ └── org
│ └── trinity
│ ├── foundation
│ └── render
│ │ └── qt
│ │ └── impl
│ │ └── painter
│ │ └── routine
│ │ └── EventInterceptionTest.java
│ └── render
│ └── qt
│ └── impl
│ ├── DummyQJRenderEngine.java
│ └── DummyView.java
├── pom.xml
├── shell
├── .gitignore
├── api
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ └── java
│ │ └── org
│ │ └── trinity
│ │ └── shell
│ │ └── api
│ │ ├── Module.java
│ │ ├── bindingkey
│ │ ├── ShellExecutor.java
│ │ ├── ShellRootNode.java
│ │ ├── ShellScene.java
│ │ └── ShellVirtualNode.java
│ │ ├── package-info.java
│ │ ├── plugin
│ │ ├── ShellPlugin.java
│ │ ├── ShellPluginsRunner.java
│ │ └── package-info.java
│ │ ├── scene
│ │ ├── AbstractAsyncShellNode.java
│ │ ├── AbstractAsyncShellNodeParent.java
│ │ ├── AbstractShellNode.java
│ │ ├── AbstractShellNodeGeometryDelegate.java
│ │ ├── AbstractShellNodeParent.java
│ │ ├── ShellNode.java
│ │ ├── ShellNodeGeometryDelegate.java
│ │ ├── ShellNodeParent.java
│ │ ├── ShellNodeTransformation.java
│ │ ├── event
│ │ │ ├── ShellNodeChildAddedEvent.java
│ │ │ ├── ShellNodeChildEvent.java
│ │ │ ├── ShellNodeChildLeftEvent.java
│ │ │ ├── ShellNodeDestroyedEvent.java
│ │ │ ├── ShellNodeEvent.java
│ │ │ ├── ShellNodeHiddenEvent.java
│ │ │ ├── ShellNodeHideRequestEvent.java
│ │ │ ├── ShellNodeLowerRequestEvent.java
│ │ │ ├── ShellNodeLoweredEvent.java
│ │ │ ├── ShellNodeMoveRequestEvent.java
│ │ │ ├── ShellNodeMoveResizeRequestEvent.java
│ │ │ ├── ShellNodeMovedEvent.java
│ │ │ ├── ShellNodeMovedResizedEvent.java
│ │ │ ├── ShellNodeRaiseRequestEvent.java
│ │ │ ├── ShellNodeRaisedEvent.java
│ │ │ ├── ShellNodeReparentRequestEvent.java
│ │ │ ├── ShellNodeReparentedEvent.java
│ │ │ ├── ShellNodeResizeRequestEvent.java
│ │ │ ├── ShellNodeResizedEvent.java
│ │ │ ├── ShellNodeShowRequestEvent.java
│ │ │ ├── ShellNodeShowedEvent.java
│ │ │ ├── ShellNodeStackingEvent.java
│ │ │ ├── ShellNodeStackingRequestEvent.java
│ │ │ ├── ShellNodeVisibilityEvent.java
│ │ │ ├── ShellNodeVisibilityRequestEvent.java
│ │ │ └── package-info.java
│ │ ├── manager
│ │ │ ├── AbstractShellLayoutManager.java
│ │ │ ├── ShellLayoutManager.java
│ │ │ ├── ShellLayoutManagerLine.java
│ │ │ ├── ShellLayoutProperty.java
│ │ │ ├── ShellLayoutPropertyLine.java
│ │ │ └── package-info.java
│ │ └── package-info.java
│ │ ├── surface
│ │ ├── AbstractAsyncShellSurface.java
│ │ ├── AbstractShellSurface.java
│ │ ├── AbstractShellSurfaceGeometryDelegate.java
│ │ ├── AbstractShellSurfaceParent.java
│ │ ├── ShellSurface.java
│ │ ├── ShellSurfaceFactory.java
│ │ ├── ShellSurfaceParent.java
│ │ └── package-info.java
│ │ └── widget
│ │ ├── BaseShellWidget.java
│ │ ├── BaseShellWidgetGeometryDelegate.java
│ │ └── ShellWidget.java
├── plugin.impl
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ └── java
│ │ └── org
│ │ └── trinity
│ │ └── shell
│ │ └── plugin
│ │ └── impl
│ │ └── ShellPluginsRunnerImpl.java
├── pom.xml
├── scene.impl
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ └── java
│ │ │ └── org
│ │ │ └── trinity
│ │ │ └── shell
│ │ │ └── scene
│ │ │ └── impl
│ │ │ ├── ShellVirtualSurface.java
│ │ │ ├── ShellVirtualSurfaceExecutor.java
│ │ │ └── manager
│ │ │ └── ShellLayoutManagerLineImpl.java
│ │ └── test
│ │ └── java
│ │ └── org
│ │ └── trinity
│ │ └── shell
│ │ └── impl
│ │ └── node
│ │ ├── ShellGeoVNodeTest.java
│ │ └── manager
│ │ └── ShellLayoutManagerLineTest.java
└── surface.impl
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ └── main
│ └── java
│ └── org
│ └── trinity
│ └── shell
│ └── surface
│ └── impl
│ ├── ShellClientSurface.java
│ ├── ShellSurfaceFactoryImpl.java
│ ├── ShellSurfaceGeometryDelegateImpl.java
│ └── ShellSurfacePlugin.java
├── shellplugin
├── .gitignore
├── pom.xml
├── widget.view.qt.api
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ └── java
│ │ └── org
│ │ └── trinity
│ │ └── shellplugin
│ │ └── widget
│ │ └── impl
│ │ └── view
│ │ └── qt
│ │ ├── AbstractQWidgetViewProvider.java
│ │ ├── LMBSignalFilter.java
│ │ └── StyledViewsPlugin.java
├── wm.api
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ └── java
│ │ └── org
│ │ └── trinity
│ │ └── shellplugin
│ │ └── wm
│ │ └── api
│ │ ├── Desktop.java
│ │ ├── HasImageDefinition.java
│ │ ├── HasText.java
│ │ ├── ImageDefinition.java
│ │ └── ReceivesPointerInput.java
└── wm.x11.impl
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ └── main
│ ├── java
│ └── org
│ │ └── trinity
│ │ └── shellplugin
│ │ └── wm
│ │ └── x11
│ │ └── impl
│ │ ├── Module.java
│ │ ├── WindowManagerPlugin.java
│ │ ├── protocol
│ │ ├── XAtomCache.java
│ │ ├── XClientMessageHandler.java
│ │ ├── XPropertyChangedHandler.java
│ │ ├── XWindowProtocol.java
│ │ └── icccm
│ │ │ ├── AbstractCachedProtocol.java
│ │ │ ├── ProtocolListener.java
│ │ │ ├── WmHints.java
│ │ │ ├── WmName.java
│ │ │ ├── WmProtocols.java
│ │ │ └── WmState.java
│ │ ├── scene
│ │ ├── ClientBarElement.java
│ │ ├── ClientBarElementFactory.java
│ │ ├── Clock.java
│ │ ├── SceneManager.java
│ │ └── ShellRootWidget.java
│ │ └── view
│ │ ├── ClientBarElementView.java
│ │ ├── Module.java
│ │ ├── NotificationsBarElementView.java
│ │ ├── RootView.java
│ │ └── RootViewProvider.java
│ └── resources
│ └── views.qss
└── site-resources
└── HypercubeLogo.png
/.gitignore:
--------------------------------------------------------------------------------
1 | *pom.xml.releaseBackup*
2 | *release.properties*
3 | *.settings*
4 | *.project*
5 | *.iml
6 | *.idea
7 | target
8 | trinity.log
9 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "externals/xcb4j"]
2 | path = externals/xcb4j
3 | url = https://github.com/Zubnix/xcb4j.git
4 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: java
2 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Development on this repository has halted. Instead have a look [here](https://github.com/Zubnix/westmalle)!
2 |
3 |
4 | [](https://travis-ci.org/Zubnix/trinityshell)
5 |
6 | Trinity shell is a Java base desktop shell for Linux.
7 | It is higly modular by design and uses Google Guice to glue different functional modules together. Currently the display module uses XCB through XCB4J to talk to the X display server while the render module uses Qt through QtJambi to do the drawing. Window manager and shell functionality is provided by shell plugins that are loaded by the shell module.
8 | It is still a young project that is usable but not usefull as a lot of very basic window managing controls are still missing. The project's ambition is to become a tool and library for Java developers to build their own fully fledged desktop, including hardware accelerated compositing, tiling window management etc.
9 |
10 | ##Building and Running
11 |
12 | - `git clone git@github.com:Zubnix/trinityshell.git` Clone the project
13 | - `git submodule init` Initialie the submodules
14 | - `git submodule update` Update the submodules
15 | - `cd externals/xcb4j` Go to the xcb4j submodule
16 | - `mvn install` Build the xcb4j sudmoule. In case xcb4j doesn't want to build, have a look at the xcb4j project on github.
17 | - `cd ../..` Go back to the project directory
18 | - `mvn install` Build the project
19 | - `cd bootstrap` Go to the bootstrap directory
20 | - `mvn assembly:assembly` Build a fat jar of the project
21 |
22 | Now startup your favority X test server (like Xephyr) eg `Xephyr -ac :1`. Set the DISPLAY environment variable to :1 with the command `export DISPLAY=:1`. Now you can start trinity shell java -jar bootstrap-0.0.2-SNAPSHOT-jar-with-dependencies.jar`. If you see errors related to libpng, install libpng12 using your distro's package manager.
23 |
24 | You'll still have to start programs from outside Trinity Shell, in command line type "xterm -display :1" and you should see them tiled up next to eachother. That's it! Cheers! If you encounter any problems you can post them in trinity shell or xcb4j respectively.
25 |
26 | ##Branches
27 |
28 | - master: Uses QtJambi (Qt bindings for java) and X. JDK7.
29 | - 0.0.3-SNAPSHOT: Uses JavaFX and X. Based on master. JDK8.
30 | - 0.1.0-SNAPSHOT: Targets wayland, the successor of X. Complete rewrite. JDK8. Further developed [here](https://github.com/Zubnix/westmalle)
31 |
--------------------------------------------------------------------------------
/bootstrap/.gitignore:
--------------------------------------------------------------------------------
1 | /.settings
2 | /.classpath
3 | /.project
4 | /target
5 | /bootstrap.iml
6 | /bin
7 | /pom.xml.releaseBackup
8 | /trinity.log
9 |
--------------------------------------------------------------------------------
/bootstrap/src/main/java/org/trinity/bootstrap/EntryPoint.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Trinity Window Manager and DesktopImpl Shell Copyright (C) 2012 Erik De
3 | * Rijcke This program is free software: you can redistribute it and/or modify
4 | * it under the terms of the GNU General Public License as published by the Free
5 | * Software Foundation, either version 3 of the License, or (at your option) any
6 | * later version. This program is distributed in the hope that it will be
7 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
8 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
9 | * Public License for more details. You should have received a copy of the GNU
10 | * General Public License along with this program. If not, see
11 | * .
12 | */
13 | package org.trinity.bootstrap;
14 |
15 | import org.apache.onami.autobind.configuration.StartupModule;
16 | import org.apache.onami.autobind.scanner.PackageFilter;
17 | import org.apache.onami.autobind.scanner.asm.ASMClasspathScanner;
18 | import org.trinity.foundation.render.qt.impl.RenderApplication;
19 | import org.trinity.shell.api.plugin.ShellPluginsRunner;
20 |
21 | import xcb4j.LibXcbLoader;
22 |
23 | import com.google.inject.Guice;
24 | import com.google.inject.Injector;
25 | import com.google.inject.Stage;
26 |
27 |
28 | public class EntryPoint {
29 |
30 | public static void main(final String[] args) {
31 |
32 | LibXcbLoader.load();
33 | RenderApplication.start();
34 |
35 | final Injector injector = Guice.createInjector( Stage.PRODUCTION,
36 | StartupModule.create(ASMClasspathScanner.class,
37 | PackageFilter.create("org.trinity")));
38 |
39 | final ShellPluginsRunner shellPluginsRunner = injector.getInstance(ShellPluginsRunner.class);
40 | shellPluginsRunner.startAll();
41 |
42 | }
43 | }
--------------------------------------------------------------------------------
/bootstrap/src/main/resources/logback.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | trinity.log
5 | true
6 |
7 | %d [%thread] %-5level %logger{35} - %msg%n
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/foundation/.gitignore:
--------------------------------------------------------------------------------
1 | /.project
2 | /.settings
3 | /pom.xml.releaseBackup
4 |
--------------------------------------------------------------------------------
/foundation/api/.gitignore:
--------------------------------------------------------------------------------
1 | /target
2 | /.settings
3 | /.classpath
4 | /.project
5 | /bin
6 | /pom.xml.releaseBackup
7 |
--------------------------------------------------------------------------------
/foundation/api/pom.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 | foundation
5 | org.trinity
6 | 0.0.2
7 |
8 | 4.0.0
9 | foundation.api
10 | Foundation API
11 | bundle
12 |
13 |
14 |
--------------------------------------------------------------------------------
/foundation/api/src/main/java/org/trinity/foundation/api/display/DisplayArea.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Trinity Shell Copyright (C) 2011 Erik De Rijcke
3 | *
4 | * This file is part of Trinity Shell.
5 | *
6 | * Trinity Shell is free software; you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the Free
8 | * Software Foundation; either version 3 of the License, or (at your option) any
9 | * later version.
10 | *
11 | * Trinity Shell is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14 | * details.
15 | *
16 | * You should have received a copy of the GNU General Public License along with
17 | * this program; if not, write to the Free Software Foundation, Inc., 51
18 | * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 | ******************************************************************************/
20 | package org.trinity.foundation.api.display;
21 |
22 | import org.trinity.foundation.api.display.bindkey.DisplayExecutor;
23 | import org.trinity.foundation.api.shared.ExecutionContext;
24 |
25 | import javax.annotation.concurrent.ThreadSafe;
26 |
27 | /**
28 | * Describes a visible part of the screen. It is the base interface of all
29 | * objects wishing to describe an on-screen surface.
30 | *
31 | * Implementation advice:
32 | *
33 | * DisplayArea implementations should have a corresponding
34 | * {@link DisplayAreaManipulator} to provide interaction.
35 | *
36 | *
37 | */
38 | @Deprecated
39 | @ExecutionContext(DisplayExecutor.class)
40 | @ThreadSafe
41 | public interface DisplayArea {
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/foundation/api/src/main/java/org/trinity/foundation/api/display/DisplaySurfaceFactory.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Trinity Shell Copyright (C) 2011 Erik De Rijcke
3 | *
4 | * This file is part of Trinity Shell.
5 | *
6 | * Trinity Shell is free software; you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the Free
8 | * Software Foundation; either version 3 of the License, or (at your option) any
9 | * later version.
10 | *
11 | * Trinity Shell is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14 | * details.
15 | *
16 | * You should have received a copy of the GNU General Public License along with
17 | * this program; if not, write to the Free Software Foundation, Inc., 51
18 | * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 | ******************************************************************************/
20 | package org.trinity.foundation.api.display;
21 |
22 | import org.trinity.foundation.api.display.bindkey.DisplayExecutor;
23 | import org.trinity.foundation.api.shared.ExecutionContext;
24 |
25 | import javax.annotation.concurrent.NotThreadSafe;
26 |
27 | /***************************************
28 | * Creates {@link DisplaySurface}s based on their {@link DisplaySurfaceHandle}.
29 | * Multiple calls to {@link #createDisplaySurface(DisplaySurfaceHandle)}
30 | * with the same {@link DisplaySurfaceHandle} arguments do not necessarily return the same
31 | * {@link DisplaySurface} instances.
32 | *
33 | ***************************************
34 | */
35 | @ExecutionContext(DisplayExecutor.class)
36 | @NotThreadSafe
37 | public interface DisplaySurfaceFactory {
38 |
39 | // FIXME this should also return a future. the display surface creation
40 | // should be done in the Display thread.
41 | /***************************************
42 | * Create a new {@link DisplaySurface} with the provided
43 | * {@link DisplaySurfaceHandle} as reference to the underlying native
44 | * resource.
45 | *
46 | * @param displaySurfaceHandle
47 | * a {@link DisplaySurfaceHandle}
48 | * @return a {@link DisplaySurface}.
49 | ***************************************
50 | */
51 | DisplaySurface createDisplaySurface(DisplaySurfaceHandle displaySurfaceHandle);
52 | }
53 |
--------------------------------------------------------------------------------
/foundation/api/src/main/java/org/trinity/foundation/api/display/DisplaySurfaceHandle.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Trinity Shell Copyright (C) 2011 Erik De Rijcke
3 | *
4 | * This file is part of Trinity Shell.
5 | *
6 | * Trinity Shell is free software; you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the Free
8 | * Software Foundation; either version 3 of the License, or (at your option) any
9 | * later version.
10 | *
11 | * Trinity Shell is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14 | * details.
15 | *
16 | * You should have received a copy of the GNU General Public License along with
17 | * this program; if not, write to the Free Software Foundation, Inc., 51
18 | * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 | ******************************************************************************/
20 | package org.trinity.foundation.api.display;
21 |
22 | import org.trinity.foundation.api.display.bindkey.DisplayExecutor;
23 | import org.trinity.foundation.api.shared.ExecutionContext;
24 |
25 | import javax.annotation.concurrent.ThreadSafe;
26 |
27 | /***************************************
28 | * Wraps a native handle to an underlying native display resource. Access to the
29 | * native handle is done by calling {@link #getNativeHandle()}.
30 | *
31 | ***************************************
32 | */
33 | @ExecutionContext(DisplayExecutor.class)
34 | @ThreadSafe
35 | public interface DisplaySurfaceHandle {
36 |
37 | /***************************************
38 | * The wrapped native display resource handle.
39 | *
40 | * @return An object, implementation dependent but usually an
41 | * {@link Integer} .
42 | ***************************************
43 | */
44 | Object getNativeHandle();
45 | }
46 |
--------------------------------------------------------------------------------
/foundation/api/src/main/java/org/trinity/foundation/api/display/Module.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Trinity Shell Copyright (C) 2011 Erik De Rijcke
3 | *
4 | * This file is part of Trinity Shell.
5 | *
6 | * Trinity Shell is free software; you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the Free
8 | * Software Foundation; either version 3 of the License, or (at your option) any
9 | * later version.
10 | *
11 | * Trinity Shell is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14 | * details.
15 | *
16 | * You should have received a copy of the GNU General Public License along with
17 | * this program; if not, write to the Free Software Foundation, Inc., 51
18 | * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 | ******************************************************************************/
20 |
21 | package org.trinity.foundation.api.display;
22 |
23 | import java.util.concurrent.Executors;
24 | import java.util.concurrent.ThreadFactory;
25 |
26 | import org.apache.onami.autobind.annotations.GuiceModule;
27 | import org.trinity.foundation.api.display.bindkey.DisplayExecutor;
28 |
29 | import com.google.common.util.concurrent.ListeningExecutorService;
30 | import com.google.common.util.concurrent.MoreExecutors;
31 | import com.google.inject.AbstractModule;
32 |
33 | @GuiceModule
34 | class Module extends AbstractModule {
35 | @Override
36 | protected void configure() {
37 | bind(ListeningExecutorService.class).annotatedWith(DisplayExecutor.class)
38 | .toInstance(MoreExecutors.listeningDecorator(Executors.newSingleThreadExecutor(new ThreadFactory() {
39 | @Override
40 | public Thread newThread(final Runnable executorRunnable) {
41 | return new Thread( executorRunnable,
42 | "display-executor");
43 | }
44 | })));
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/foundation/api/src/main/java/org/trinity/foundation/api/display/Screen.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Trinity Shell Copyright (C) 2011 Erik De Rijcke
3 | *
4 | * This file is part of Trinity Shell.
5 | *
6 | * Trinity Shell is free software; you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the Free
8 | * Software Foundation; either version 3 of the License, or (at your option) any
9 | * later version.
10 | *
11 | * Trinity Shell is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14 | * details.
15 | *
16 | * You should have received a copy of the GNU General Public License along with
17 | * this program; if not, write to the Free Software Foundation, Inc., 51
18 | * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 | ******************************************************************************/
20 |
21 | package org.trinity.foundation.api.display;
22 |
23 | import javax.annotation.concurrent.ThreadSafe;
24 | import javax.inject.Singleton;
25 |
26 | import org.trinity.foundation.api.display.bindkey.DisplayExecutor;
27 | import org.trinity.foundation.api.shared.ExecutionContext;
28 | import org.trinity.foundation.api.shared.Size;
29 |
30 | /**
31 | * The logical screen of a {@link Display}.
32 | */
33 | @ExecutionContext(DisplayExecutor.class)
34 | @ThreadSafe
35 | public interface Screen {
36 |
37 | /**
38 | * The current size of the screen.
39 | *
40 | * @return size in pixels.
41 | */
42 | Size getSize();
43 | }
44 |
--------------------------------------------------------------------------------
/foundation/api/src/main/java/org/trinity/foundation/api/display/bindkey/DisplayExecutor.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Trinity Shell Copyright (C) 2011 Erik De Rijcke
3 | *
4 | * This file is part of Trinity Shell.
5 | *
6 | * Trinity Shell is free software; you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the Free
8 | * Software Foundation; either version 3 of the License, or (at your option) any
9 | * later version.
10 | *
11 | * Trinity Shell is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14 | * details.
15 | *
16 | * You should have received a copy of the GNU General Public License along with
17 | * this program; if not, write to the Free Software Foundation, Inc., 51
18 | * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 | ******************************************************************************/
20 | package org.trinity.foundation.api.display.bindkey;
21 |
22 | import com.google.common.util.concurrent.ListeningExecutorService;
23 | import com.google.inject.BindingAnnotation;
24 | import org.trinity.foundation.api.shared.ExecutionContext;
25 |
26 | import javax.inject.Singleton;
27 | import java.lang.annotation.Retention;
28 | import java.lang.annotation.Target;
29 |
30 | import static java.lang.annotation.ElementType.FIELD;
31 | import static java.lang.annotation.ElementType.METHOD;
32 | import static java.lang.annotation.ElementType.PARAMETER;
33 | import static java.lang.annotation.ElementType.TYPE;
34 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
35 |
36 | /**
37 | * Used for the 'Display' {@link ExecutionContext}. A {@link Singleton}
38 | * {@link ListeningExecutorService} with this key is provided by the
39 | * org.trinity.foundation.api.display package.
40 | */
41 | @BindingAnnotation
42 | @Target({ TYPE, FIELD, PARAMETER, METHOD })
43 | @Retention(RUNTIME)
44 | public @interface DisplayExecutor {
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/foundation/api/src/main/java/org/trinity/foundation/api/display/event/CreationNotify.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Trinity Shell Copyright (C) 2011 Erik De Rijcke
3 | *
4 | * This file is part of Trinity Shell.
5 | *
6 | * Trinity Shell is free software; you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the Free
8 | * Software Foundation; either version 3 of the License, or (at your option) any
9 | * later version.
10 | *
11 | * Trinity Shell is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14 | * details.
15 | *
16 | * You should have received a copy of the GNU General Public License along with
17 | * this program; if not, write to the Free Software Foundation, Inc., 51
18 | * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 | ******************************************************************************/
20 |
21 | package org.trinity.foundation.api.display.event;
22 |
23 | import javax.annotation.Nonnull;
24 | import javax.annotation.concurrent.Immutable;
25 | import javax.inject.Singleton;
26 |
27 | import org.trinity.foundation.api.display.Display;
28 | import org.trinity.foundation.api.display.DisplaySurface;
29 | import org.trinity.foundation.api.display.bindkey.DisplayExecutor;
30 | import org.trinity.foundation.api.shared.ExecutionContext;
31 |
32 | /**
33 | * Signals the {@link Display} {@link Singleton} that a new client
34 | * {@link DisplaySurface} is available.
35 | */
36 | @Immutable
37 | @ExecutionContext(DisplayExecutor.class)
38 | public class CreationNotify extends DisplayEvent {
39 | private final DisplaySurface displaySurface;
40 |
41 | public CreationNotify(@Nonnull final DisplaySurface displaySurface) {
42 | this.displaySurface = displaySurface;
43 | }
44 |
45 | public DisplaySurface getDisplaySurface() {
46 | return this.displaySurface;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/foundation/api/src/main/java/org/trinity/foundation/api/display/event/DestroyNotify.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Trinity Shell Copyright (C) 2011 Erik De Rijcke
3 | *
4 | * This file is part of Trinity Shell.
5 | *
6 | * Trinity Shell is free software; you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the Free
8 | * Software Foundation; either version 3 of the License, or (at your option) any
9 | * later version.
10 | *
11 | * Trinity Shell is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14 | * details.
15 | *
16 | * You should have received a copy of the GNU General Public License along with
17 | * this program; if not, write to the Free Software Foundation, Inc., 51
18 | * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 | ******************************************************************************/
20 | package org.trinity.foundation.api.display.event;
21 |
22 | import org.trinity.foundation.api.display.DisplaySurface;
23 | import org.trinity.foundation.api.display.bindkey.DisplayExecutor;
24 | import org.trinity.foundation.api.shared.ExecutionContext;
25 |
26 | import javax.annotation.concurrent.Immutable;
27 |
28 | /***************************************
29 | * Indicates that a {@link DisplaySurface} has been destroyed.
30 | *
31 | ***************************************
32 | */
33 | @Immutable
34 | @ExecutionContext(DisplayExecutor.class)
35 | public class DestroyNotify extends DisplayEvent {
36 |
37 | }
--------------------------------------------------------------------------------
/foundation/api/src/main/java/org/trinity/foundation/api/display/event/DisplayEvent.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Trinity Shell Copyright (C) 2011 Erik De Rijcke
3 | *
4 | * This file is part of Trinity Shell.
5 | *
6 | * Trinity Shell is free software; you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the Free
8 | * Software Foundation; either version 3 of the License, or (at your option) any
9 | * later version.
10 | *
11 | * Trinity Shell is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14 | * details.
15 | *
16 | * You should have received a copy of the GNU General Public License along with
17 | * this program; if not, write to the Free Software Foundation, Inc., 51
18 | * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 | ******************************************************************************/
20 | package org.trinity.foundation.api.display.event;
21 |
22 | import javax.annotation.concurrent.Immutable;
23 |
24 | import org.trinity.foundation.api.display.bindkey.DisplayExecutor;
25 | import org.trinity.foundation.api.shared.ExecutionContext;
26 |
27 | /**
28 | * The general superclass for all display related events.
29 | */
30 | @Immutable
31 | @ExecutionContext(DisplayExecutor.class)
32 | public class DisplayEvent {
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/foundation/api/src/main/java/org/trinity/foundation/api/display/event/FocusGainNotify.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Trinity Shell Copyright (C) 2011 Erik De Rijcke
3 | *
4 | * This file is part of Trinity Shell.
5 | *
6 | * Trinity Shell is free software; you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the Free
8 | * Software Foundation; either version 3 of the License, or (at your option) any
9 | * later version.
10 | *
11 | * Trinity Shell is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14 | * details.
15 | *
16 | * You should have received a copy of the GNU General Public License along with
17 | * this program; if not, write to the Free Software Foundation, Inc., 51
18 | * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 | ******************************************************************************/
20 | package org.trinity.foundation.api.display.event;
21 |
22 | import org.trinity.foundation.api.display.DisplaySurface;
23 | import org.trinity.foundation.api.display.bindkey.DisplayExecutor;
24 | import org.trinity.foundation.api.shared.ExecutionContext;
25 |
26 | import javax.annotation.concurrent.Immutable;
27 |
28 | /***************************************
29 | * Indicates that a {@link DisplaySurface} has gained input focus.
30 | *
31 | ***************************************
32 | */
33 | @Immutable
34 | @ExecutionContext(DisplayExecutor.class)
35 | public class FocusGainNotify extends FocusNotify {
36 |
37 | }
--------------------------------------------------------------------------------
/foundation/api/src/main/java/org/trinity/foundation/api/display/event/FocusLostNotify.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Trinity Shell Copyright (C) 2011 Erik De Rijcke
3 | *
4 | * This file is part of Trinity Shell.
5 | *
6 | * Trinity Shell is free software; you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the Free
8 | * Software Foundation; either version 3 of the License, or (at your option) any
9 | * later version.
10 | *
11 | * Trinity Shell is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14 | * details.
15 | *
16 | * You should have received a copy of the GNU General Public License along with
17 | * this program; if not, write to the Free Software Foundation, Inc., 51
18 | * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 | ******************************************************************************/
20 | package org.trinity.foundation.api.display.event;
21 |
22 | import org.trinity.foundation.api.display.DisplaySurface;
23 | import org.trinity.foundation.api.display.bindkey.DisplayExecutor;
24 | import org.trinity.foundation.api.shared.ExecutionContext;
25 |
26 | import javax.annotation.concurrent.Immutable;
27 |
28 | /***************************************
29 | * Indicates that a {@link DisplaySurface} has lost input focus.
30 | *
31 | ***************************************
32 | */
33 | @Immutable
34 | @ExecutionContext(DisplayExecutor.class)
35 | public class FocusLostNotify extends FocusNotify {
36 |
37 | }
--------------------------------------------------------------------------------
/foundation/api/src/main/java/org/trinity/foundation/api/display/event/FocusNotify.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Trinity Shell Copyright (C) 2011 Erik De Rijcke
3 | *
4 | * This file is part of Trinity Shell.
5 | *
6 | * Trinity Shell is free software; you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the Free
8 | * Software Foundation; either version 3 of the License, or (at your option) any
9 | * later version.
10 | *
11 | * Trinity Shell is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14 | * details.
15 | *
16 | * You should have received a copy of the GNU General Public License along with
17 | * this program; if not, write to the Free Software Foundation, Inc., 51
18 | * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 | ******************************************************************************/
20 | package org.trinity.foundation.api.display.event;
21 |
22 | import javax.annotation.concurrent.Immutable;
23 |
24 | import org.trinity.foundation.api.display.bindkey.DisplayExecutor;
25 | import org.trinity.foundation.api.shared.ExecutionContext;
26 |
27 | /****************************************
28 | * A generic abstract class for focus related events.
29 | *
30 | ***************************************
31 | */
32 | @Immutable
33 | @ExecutionContext(DisplayExecutor.class)
34 | public class FocusNotify extends DisplayEvent {
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/foundation/api/src/main/java/org/trinity/foundation/api/display/event/HideNotify.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Trinity Shell Copyright (C) 2011 Erik De Rijcke
3 | *
4 | * This file is part of Trinity Shell.
5 | *
6 | * Trinity Shell is free software; you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the Free
8 | * Software Foundation; either version 3 of the License, or (at your option) any
9 | * later version.
10 | *
11 | * Trinity Shell is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14 | * details.
15 | *
16 | * You should have received a copy of the GNU General Public License along with
17 | * this program; if not, write to the Free Software Foundation, Inc., 51
18 | * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 | ******************************************************************************/
20 | package org.trinity.foundation.api.display.event;
21 |
22 | import org.trinity.foundation.api.display.DisplaySurface;
23 | import org.trinity.foundation.api.display.bindkey.DisplayExecutor;
24 | import org.trinity.foundation.api.shared.ExecutionContext;
25 |
26 | import javax.annotation.concurrent.Immutable;
27 |
28 | /**
29 | * Notifies when a {@link DisplaySurface} is made invisible.
30 | *
31 | */
32 | @Immutable
33 | @ExecutionContext(DisplayExecutor.class)
34 | public class HideNotify extends DisplayEvent {
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/foundation/api/src/main/java/org/trinity/foundation/api/display/event/PointerEnterNotify.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Trinity Shell Copyright (C) 2011 Erik De Rijcke
3 | *
4 | * This file is part of Trinity Shell.
5 | *
6 | * Trinity Shell is free software; you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the Free
8 | * Software Foundation; either version 3 of the License, or (at your option) any
9 | * later version.
10 | *
11 | * Trinity Shell is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14 | * details.
15 | *
16 | * You should have received a copy of the GNU General Public License along with
17 | * this program; if not, write to the Free Software Foundation, Inc., 51
18 | * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 | ******************************************************************************/
20 | package org.trinity.foundation.api.display.event;
21 |
22 | import javax.annotation.concurrent.Immutable;
23 |
24 | import org.trinity.foundation.api.display.DisplaySurface;
25 | import org.trinity.foundation.api.display.bindkey.DisplayExecutor;
26 | import org.trinity.foundation.api.shared.ExecutionContext;
27 |
28 | /***************************************
29 | * Indicates when a pointer device has entered a {@link DisplaySurface}.
30 | *
31 | ***************************************
32 | */
33 | @Immutable
34 | @ExecutionContext(DisplayExecutor.class)
35 | public class PointerEnterNotify extends PointerVisitationNotify {
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/foundation/api/src/main/java/org/trinity/foundation/api/display/event/PointerLeaveNotify.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Trinity Shell Copyright (C) 2011 Erik De Rijcke
3 | *
4 | * This file is part of Trinity Shell.
5 | *
6 | * Trinity Shell is free software; you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the Free
8 | * Software Foundation; either version 3 of the License, or (at your option) any
9 | * later version.
10 | *
11 | * Trinity Shell is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14 | * details.
15 | *
16 | * You should have received a copy of the GNU General Public License along with
17 | * this program; if not, write to the Free Software Foundation, Inc., 51
18 | * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 | ******************************************************************************/
20 | package org.trinity.foundation.api.display.event;
21 |
22 | import org.trinity.foundation.api.display.DisplaySurface;
23 | import org.trinity.foundation.api.display.bindkey.DisplayExecutor;
24 | import org.trinity.foundation.api.shared.ExecutionContext;
25 |
26 | import javax.annotation.concurrent.Immutable;
27 |
28 | /***************************************
29 | * Indicates when a pointer device has left a {@link DisplaySurface}.
30 | *
31 | ***************************************
32 | */
33 | @Immutable
34 | @ExecutionContext(DisplayExecutor.class)
35 | public class PointerLeaveNotify extends PointerVisitationNotify {
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/foundation/api/src/main/java/org/trinity/foundation/api/display/event/PointerVisitationNotify.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Trinity Shell Copyright (C) 2011 Erik De Rijcke
3 | *
4 | * This file is part of Trinity Shell.
5 | *
6 | * Trinity Shell is free software; you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the Free
8 | * Software Foundation; either version 3 of the License, or (at your option) any
9 | * later version.
10 | *
11 | * Trinity Shell is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14 | * details.
15 | *
16 | * You should have received a copy of the GNU General Public License along with
17 | * this program; if not, write to the Free Software Foundation, Inc., 51
18 | * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 | ******************************************************************************/
20 | package org.trinity.foundation.api.display.event;
21 |
22 | import javax.annotation.concurrent.Immutable;
23 |
24 | import org.trinity.foundation.api.display.DisplaySurface;
25 | import org.trinity.foundation.api.display.bindkey.DisplayExecutor;
26 | import org.trinity.foundation.api.shared.ExecutionContext;
27 |
28 | /****************************************
29 | * Indicates when a pointer device has crossed the boundary of a
30 | * {@link DisplaySurface}.
31 | *
32 | ***************************************
33 | */
34 | @Immutable
35 | @ExecutionContext(DisplayExecutor.class)
36 | public class PointerVisitationNotify extends DisplayEvent {
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/foundation/api/src/main/java/org/trinity/foundation/api/display/event/ShowNotify.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Trinity Shell Copyright (C) 2011 Erik De Rijcke
3 | *
4 | * This file is part of Trinity Shell.
5 | *
6 | * Trinity Shell is free software; you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the Free
8 | * Software Foundation; either version 3 of the License, or (at your option) any
9 | * later version.
10 | *
11 | * Trinity Shell is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14 | * details.
15 | *
16 | * You should have received a copy of the GNU General Public License along with
17 | * this program; if not, write to the Free Software Foundation, Inc., 51
18 | * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 | ******************************************************************************/
20 | package org.trinity.foundation.api.display.event;
21 |
22 | import org.trinity.foundation.api.display.DisplaySurface;
23 | import org.trinity.foundation.api.display.bindkey.DisplayExecutor;
24 | import org.trinity.foundation.api.shared.ExecutionContext;
25 |
26 | import javax.annotation.concurrent.Immutable;
27 |
28 | /***************************************
29 | * Notifies that a {@link DisplaySurface} has become visible.
30 | ***************************************
31 | */
32 | @Immutable
33 | @ExecutionContext(DisplayExecutor.class)
34 | public class ShowNotify extends DisplayEvent {
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/foundation/api/src/main/java/org/trinity/foundation/api/display/event/ShowRequest.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Trinity Shell Copyright (C) 2011 Erik De Rijcke
3 | *
4 | * This file is part of Trinity Shell.
5 | *
6 | * Trinity Shell is free software; you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the Free
8 | * Software Foundation; either version 3 of the License, or (at your option) any
9 | * later version.
10 | *
11 | * Trinity Shell is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14 | * details.
15 | *
16 | * You should have received a copy of the GNU General Public License along with
17 | * this program; if not, write to the Free Software Foundation, Inc., 51
18 | * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 | ******************************************************************************/
20 | package org.trinity.foundation.api.display.event;
21 |
22 | import org.trinity.foundation.api.display.DisplaySurface;
23 | import org.trinity.foundation.api.display.bindkey.DisplayExecutor;
24 | import org.trinity.foundation.api.shared.ExecutionContext;
25 |
26 | import javax.annotation.concurrent.Immutable;
27 |
28 | /****************************************
29 | * A request to make a {@link DisplaySurface} visible.
30 | ***************************************
31 | */
32 | @Immutable
33 | @ExecutionContext(DisplayExecutor.class)
34 | public class ShowRequest extends DisplayEvent {
35 |
36 | }
--------------------------------------------------------------------------------
/foundation/api/src/main/java/org/trinity/foundation/api/display/event/StackingChangedNotify.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Trinity Shell Copyright (C) 2011 Erik De Rijcke
3 | *
4 | * This file is part of Trinity Shell.
5 | *
6 | * Trinity Shell is free software; you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the Free
8 | * Software Foundation; either version 3 of the License, or (at your option) any
9 | * later version.
10 | *
11 | * Trinity Shell is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14 | * details.
15 | *
16 | * You should have received a copy of the GNU General Public License along with
17 | * this program; if not, write to the Free Software Foundation, Inc., 51
18 | * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 | ******************************************************************************/
20 | package org.trinity.foundation.api.display.event;
21 |
22 | import org.trinity.foundation.api.display.DisplaySurface;
23 | import org.trinity.foundation.api.display.bindkey.DisplayExecutor;
24 | import org.trinity.foundation.api.shared.ExecutionContext;
25 |
26 | import javax.annotation.concurrent.Immutable;
27 |
28 | /***************************************
29 | * Notifies that the stacking of a {@link DisplaySurface} has changed
30 | ***************************************
31 | */
32 | @Immutable
33 | @ExecutionContext(DisplayExecutor.class)
34 | public class StackingChangedNotify extends DisplayEvent {
35 |
36 | }
--------------------------------------------------------------------------------
/foundation/api/src/main/java/org/trinity/foundation/api/display/event/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Events used by the foundation display API to communicate the state of the
3 | * display server.
4 | */
5 | package org.trinity.foundation.api.display.event;
--------------------------------------------------------------------------------
/foundation/api/src/main/java/org/trinity/foundation/api/display/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Defines display server communication and manipulation.
3 | */
4 | package org.trinity.foundation.api.display;
--------------------------------------------------------------------------------
/foundation/api/src/main/java/org/trinity/foundation/api/render/Painter.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Trinity Shell Copyright (C) 2011 Erik De Rijcke
3 | *
4 | * This file is part of Trinity Shell.
5 | *
6 | * Trinity Shell is free software; you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the Free
8 | * Software Foundation; either version 3 of the License, or (at your option) any
9 | * later version.
10 | *
11 | * Trinity Shell is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14 | * details.
15 | *
16 | * You should have received a copy of the GNU General Public License along with
17 | * this program; if not, write to the Free Software Foundation, Inc., 51
18 | * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 | ******************************************************************************/
20 | package org.trinity.foundation.api.render;
21 |
22 | import org.trinity.foundation.api.display.DisplayArea;
23 | import org.trinity.foundation.api.display.DisplayAreaManipulator;
24 | import org.trinity.foundation.api.display.DisplaySurface;
25 | import org.trinity.foundation.api.render.bindkey.RenderExecutor;
26 | import org.trinity.foundation.api.shared.ExecutionContext;
27 |
28 | import com.google.common.util.concurrent.ListenableFuture;
29 |
30 | /****************************************
31 | * Talks to a paint back-end and manipulates the geometry of the view model it is
32 | * bound to. A painter is created through the {@link PainterFactory}.
33 | ***************************************
34 | */
35 |
36 | @Deprecated
37 | @ExecutionContext(RenderExecutor.class)
38 | public interface Painter extends DisplayAreaManipulator {
39 |
40 | /**
41 | *
42 | * Get the {@link DisplaySurface} that the render back-end uses to paint the
43 | * view on.
44 | *
45 | * @return A future {@link DisplaySurface}.
46 | */
47 | @Deprecated
48 | ListenableFuture getDislaySurface();
49 |
50 | /***************************************
51 | * Bind the render toolkit specific view to the {@link DisplayArea} of the
52 | * {@code Painter}.
53 | ***************************************
54 | */
55 | @Deprecated
56 | ListenableFuture bindView();
57 | }
58 |
--------------------------------------------------------------------------------
/foundation/api/src/main/java/org/trinity/foundation/api/render/PainterFactory.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Trinity Shell Copyright (C) 2011 Erik De Rijcke
3 | *
4 | * This file is part of Trinity Shell.
5 | *
6 | * Trinity Shell is free software; you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the Free
8 | * Software Foundation; either version 3 of the License, or (at your option) any
9 | * later version.
10 | *
11 | * Trinity Shell is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14 | * details.
15 | *
16 | * You should have received a copy of the GNU General Public License along with
17 | * this program; if not, write to the Free Software Foundation, Inc., 51
18 | * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 | ******************************************************************************/
20 | package org.trinity.foundation.api.render;
21 |
22 | import org.trinity.foundation.api.shared.AsyncListenable;
23 |
24 | import com.google.common.util.concurrent.ListeningExecutorService;
25 |
26 | //TODO documentation
27 | /***************************************
28 | * Creates new {@link Painter} delegates for a view model.
29 | *
30 | ***************************************
31 | */
32 | @Deprecated
33 | public interface PainterFactory {
34 |
35 | // FIXME this should return a future. painter creation should be done on the
36 | // Render thread.
37 | /**
38 | * Creates a new {@code Painter} for the given view model. Multiple calls
39 | * with the same model should create a new {@code Painter} instance each
40 | * time.
41 | *
42 | * @param viewModel
43 | * The view model that the created {@code Painter} will use as a
44 | * visual base.
45 | * @return a new {@link Painter}
46 | */
47 | Painter createPainter( ListeningExecutorService viewModelExecutor,
48 | final AsyncListenable viewModel);
49 | }
50 |
--------------------------------------------------------------------------------
/foundation/api/src/main/java/org/trinity/foundation/api/render/binding/model/ViewReference.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Trinity Shell Copyright (C) 2011 Erik De Rijcke
3 | *
4 | * This file is part of Trinity Shell.
5 | *
6 | * Trinity Shell is free software; you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the Free
8 | * Software Foundation; either version 3 of the License, or (at your option) any
9 | * later version.
10 | *
11 | * Trinity Shell is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14 | * details.
15 | *
16 | * You should have received a copy of the GNU General Public License along with
17 | * this program; if not, write to the Free Software Foundation, Inc., 51
18 | * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 | ******************************************************************************/
20 | package org.trinity.foundation.api.render.binding.model;
21 |
22 | import java.lang.annotation.ElementType;
23 | import java.lang.annotation.Retention;
24 | import java.lang.annotation.RetentionPolicy;
25 | import java.lang.annotation.Target;
26 |
27 | import com.google.common.util.concurrent.ListeningExecutorService;
28 | import org.trinity.foundation.api.render.binding.Binder;
29 |
30 | /***************************************
31 | * Marks a method as the getter of the view of a model.
32 | *
33 | * @see Binder#bind(ListeningExecutorService, Object, Object)
34 | ***************************************
35 | */
36 | @Retention(RetentionPolicy.RUNTIME)
37 | @Target({ ElementType.METHOD })
38 | public @interface ViewReference {
39 |
40 | }
--------------------------------------------------------------------------------
/foundation/api/src/main/java/org/trinity/foundation/api/render/binding/package-info.java:
--------------------------------------------------------------------------------
1 | // TODO extensive documentation on how to use the binding api.
2 | /**
3 | * A basic model
4 | * view - viewmodel pattern. It offers the following bindings between a
5 | * viewmodel, which can be any type of object, and view, usually of type
6 | * {@link org.trinity.foundation.api.render.binding.view.View}.
7 | *
23 | */
24 | package org.trinity.foundation.api.render.binding;
--------------------------------------------------------------------------------
/foundation/api/src/main/java/org/trinity/foundation/api/render/binding/view/DefaultPropertyAdapter.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Trinity Shell Copyright (C) 2011 Erik De Rijcke
3 | *
4 | * This file is part of Trinity Shell.
5 | *
6 | * Trinity Shell is free software; you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the Free
8 | * Software Foundation; either version 3 of the License, or (at your option) any
9 | * later version.
10 | *
11 | * Trinity Shell is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14 | * details.
15 | *
16 | * You should have received a copy of the GNU General Public License along with
17 | * this program; if not, write to the Free Software Foundation, Inc., 51
18 | * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 | ******************************************************************************/
20 | package org.trinity.foundation.api.render.binding.view;
21 |
22 | import org.trinity.foundation.api.render.bindkey.RenderExecutor;
23 | import org.trinity.foundation.api.shared.ExecutionContext;
24 |
25 | import javax.annotation.Nullable;
26 |
27 | /***************************************
28 | * A default implementation of a {@link PropertyAdapter}. It simply returns the
29 | * property value without modification. Used as the default value in
30 | * {@link PropertySlot#adapter()}.
31 | *
32 | ***************************************
33 | */
34 | @ExecutionContext(RenderExecutor.class)
35 | public class DefaultPropertyAdapter implements PropertyAdapter