-
Notifications
You must be signed in to change notification settings - Fork 244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
some base level additions and minor cleanup and window title bar drag ability #498
some base level additions and minor cleanup and window title bar drag ability #498
Conversation
This PR represents commonality sliced out of the PR of the ScrollPanel stuff. Once this makes it through, I'll put in a PR for the ImageComponent, then another PR for the SplitPanel. I think then the ScrolPanel PR will be hopefully on topic specifically enough. Thanks! |
@@ -44,6 +45,8 @@ | |||
private boolean strictFocusChange; | |||
private boolean enableDirectionBasedMovements; | |||
private Theme theme; | |||
|
|||
private Interactable mouseDownForDrag = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes it so that the component which experienced the mouse down is the component which the mouse drags get routed to.
…dows() with stable ordering of windows
if(globalPosition == null || lastKnownPosition == null) { | ||
return null; | ||
} | ||
return globalPosition.withRelative( | ||
-lastKnownPosition.getColumn() - contentOffset.getColumn(), | ||
-lastKnownPosition.getRow() - contentOffset.getRow()); | ||
} | ||
|
||
@Override |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Used by MultiWindowTextGUI.
@@ -558,15 +557,15 @@ private Result handleEditableCBKeyStroke(KeyStroke keyStroke) { | |||
public PopupWindow() { | |||
setHints(Arrays.asList( | |||
Hint.NO_FOCUS, | |||
Hint.FIXED_POSITION)); | |||
Hint.FIXED_POSITION, | |||
Hint.MENU_POPUP)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Used by MultiWindowTextGUI.
@@ -46,12 +46,17 @@ | |||
private final WindowManager windowManager; | |||
private final BasePane backgroundPane; | |||
private final List<Window> windows; | |||
private final List<Window> stableOrderingOfWindows; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The purpose of the list stableOrderingOfWindows vs the windows list is that the WindowManager would prefer to have the same ordering everytime.
For example a 2x2 grid style window manager would like to arrange the windows in position and size and have those remain regardless of which window is active.
Prior to this change, the windows are coming through in different order because the active window is put to the front of the list, this would force most window managers to do this bookkeeping work which seems to involve overriding multiple methods.
So essentially z-order is what the existing windows list does, but most window managers would probably want access to z-ordering only secondarily to their primary ordering for layout purposes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, but I think in that case rather than having two lists, we should create a WindowList
class or something like that, which can encapsulate the z-index and the stable index. It would make the code interacting with the list(s) of windows in here much easier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added a WindowList class.
@@ -180,6 +181,13 @@ public String toString() { | |||
@Override | |||
void invalidate(); | |||
|
|||
|
|||
default TerminalRectangle getBounds() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to add Javadoc to this one and the two below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated with some javadocs.
@@ -390,7 +398,11 @@ public String toString() { | |||
* @return The global coordinates expressed as local coordinates | |||
*/ | |||
@Override | |||
@Deprecated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a @deprecated
Javadoc note for this and explain what to use instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated with some javadocs.
Looks like we can merge this with a few tweaks. For some of the bigger changes in the other PR, I think we want to target master (3.2). But let's see, one PR at a time. |
Ok, I think this is ready for next round. Once this is through, I think I can slice out the ImageComponent with pretty much cleanly for another PR. |
Since which Java version can keyword "default" be used in that context?
ginkoblongata <notifications@github.com> schrieb am Sa., 11. Juli 2020,
20:48:
… ***@***.**** commented on this pull request.
------------------------------
In src/main/java/com/googlecode/lanterna/gui2/Window.java
<#498 (comment)>:
> @@ -180,6 +181,13 @@ public String toString() {
@OverRide
void invalidate();
+
+ default TerminalRectangle getBounds() {
I've updated with some javadocs.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#498 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABIDBMUXHQV5HCPNUCBOGOTR3CXWDANCNFSM4OKURVAA>
.
|
Java 8 introduced the default keyword on interface methods. |
Yes, also, by adding to the interface like that with the 'default' it makes it so that existing implementations of the interface can continue to work as is. I am hoping this PR will make it in. |
Alright, that is now merged into 3.1 |
No description provided.