-
Notifications
You must be signed in to change notification settings - Fork 106
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
13197 - Mac interface cleanup and Legacy preference #107
Conversation
This is good. There's a lot of missing Override annotations in that area, perhaps you could add them, they make navigating the class/interface structure easier for humans and development tools:
|
Will do |
STAGE 2 - Module KeyStroke's translated back and forth from "Command" to "Control" at the appropriate places.
Here is a secondary detail that I need advice on: I need to do ONE of the following: |
Meanwhile, @uckelman we are probably ready for some test builds so that I can test this on Mac. The thought of installing a dev environment on my wife's Macbook Pro sends cold chills up my spine... Unfortunately there will probably of course be a few rounds of test builds, Unless God Has Granted A Miracle. |
Or if there's some way that "through the magic of maven" I can cause a mac build to get made here on my Windows machine... |
It is still a "make" project on Linux, maven builds the Java part but the make system takes care of packaging the final distribution. If you can install git and have a Java installation, you could clone the repo, use the maven wrapper to build the jar, unzip the Vassal's "other" distribution somewhere, replace it's jar files with the ones you built, and start it using the VASSAL.sh script. |
I'd have to figure out how to do all of that on a Mac (sort of like having my right arm tied behind my back and several fingers of my left hand removed), and during the brief windows I can borrow my wife's laptop! Now if there's a way to build a Mac version on my Windows machine... |
@yanlyub Investigating installing a Ubuntu virtual machine on my Windows. We'll see how far I get :) (By "investigating", I mean the install "has 19 minutes remaining...") |
@yanlyub Okay, so let's say I've got a little Ubuntu virtual machine running, and it has "git" and "java 11 sdk" installed for at least some value of "installed". Like I can type "java" at a $ prompt and get a spew of java-y stuff. And I can type "git" and I've told it I exist (user.name and stuff) and it recognizes me. I "shared" my Windows folder of vassal over, but when I type "git status" in that folder from the Ubuntu side of the world, I get an immense spew of "everything in the world has changed", so in other words, git isn't "really" playing well with that folder (on Windows side typing "git status" in same folder says I'm all clean). So maybe I'd better make a new folder in my Ubuntu drive and just pull Vassal down into THAT. But meanwhile, what OTHER stuff do I need to get to be able to build the makefile? I tried "sudo apt-get install make" and it "made something install", but when I typed make in the vassal directory it was "sad". |
Changes to everything is due likely to line ending differences between Windows and Linux. What you need for making Mac builds is genisoimage (for which there will be an Ubuntu package) and dmg (for which there is probably not an Ubuntu package). I was already intending to see about updating dmg and providing a simple way to build it; I may run that down in the coming week. |
Yes git on linux handles line endings differently from windows, just clone the repo into a new folder inside your VM. You could install several more JDKs, they come in handy when you want to try different Java and Vassal versions, Vassal 3.2 will need JDK 8. You could install these three for instance: a JDK 8 for running Vassal 3.2, JDK 11 as it's the long-term release and the minimum required JDK for building Vassal 3.3, and JDK 14 as it's the most modern one and it's VM should run Vassal in the most performant way. For the makefile to build a release, ultimately you will have to ask @uckelman as I never tried setting up my machine to do the full build cycle, I only know that you can install nsis and genisoimage from the package manager. To install all these packages:
You can also type One of the Javas will be set as the default, you can choose which one like this: https://askubuntu.com/a/740782 But even then you can still choose which one you use by using the absolute path, e.g.:
(They all are in In Eclipse / IntelliJ you can add any available JDK in the compiler settings (IntelliJ will automatically find them anyways) and select which one is used for the project. |
It's |
Are you current with master? I suspect you're getting a stray newline in |
Seems to think everything is up to date |
I'd pulled the version down for the very first time a couple hours ago. |
It looks like |
jdk.crypto.ec,Error: unknown option: --ignore-missing-depsUsage: jdeps <path...>]use --help for a list of possible options lol |
Maybe it doesn't like my Java 11 jdk. Still trying to figure out where to get 14. Yan's command earlier didn't find it. |
Which ubuntu version did you install? |
how do I tell? |
By the way I did manage to get a jdk14 installed, and got a lot farther. Am now missing, as Joel predicted, libdmg-hfsplus |
Apparently I am about to go on a "Voyage of Discovery" of downloading THAT repository and compiling it :) |
Try |
I have installed all of the things you described above. Of course I'm probably missing something else. I googled an article about how to install/build libdmg-hfsplus and followed all of those steps, but it doesn't remedy this. |
I just tried it myself, getting the same compile error in filevault.c or filevault.h or however this build log is supposed to be read. |
A thing I just remembered: You don't actually need |
This is all unnecessary if you guys just give me a chance to deal with |
An automated build would be great, we could give it to any CI server and you wouldn't be the only guy on this planet anymore who can produce all the necessary releases. |
@uckelman Totally great to deal with dmg but in the meantime I actually got it to compile (got the old libssl through some hanky panky from one of those articles). So you're absolutely right that's probably not the thread we want everything to hang from but I was "on a tear" and got it running. Need a Mac build? ;) @yanlyub Oh you're probably right it's probably still got old-style modifier in the mask and then adding the new one back in because it sees that. Whee! |
If you're asking Java to do something with key modifiers, there's a good shot that if it sees one of the |
Yep that was it. This should go quickly now :-) |
Okay, next little mystery, @uckelman and @yanlyub. I'm less mystified by "why this doesn't work now" and more mystified by "how did this ever work". The following is from ForwardToKeyBuffer. Note that we're sending all three of "keyPressed", "keyTyped", and "keyReleased" in to "process". And there's special code explicitly designed to consume & ignore the "keyTyped", so yay for that. But then the keyReleased arrives and gets processed, and there's nothing here designed to consume/ignore it. So the behavior I'm seeing is... my "translated" command gets translated correctly, and it gets recognized correctly... and it activates TWICE! And yet this is the exact logic that was in here before, apart from me changing the getKeyStrokeForEvent() to filter through my special method. Any ideas? (Also code markup refuses to indent this code, for no reason I can find) ` @OverRide @OverRide protected void process(KeyEvent e) { |
I can only approach this from the theoretical perspective, having almost no practical experience with these keyboard/mouse parts of Java. Isn't "keyTyped" same as "keyPressed" and "keyReleased" combined into one event? And if "keyPressed" is processed and the "keyTyped" that belongs to that same "keyPressed" is ignored, shouldn't the "keyReleased" that also belongs to the "keyPressed" be ignored as well? |
Well that's the logic I'd be coming at it with too, and yet "somehow this always worked". So I'm wondering if there's "secret Java voodoo" at work (like the kind where the KeyStroke regrew its CTRL_DOWN_MASK because of the deprecated flag still being on) |
Okay I think I've found it. There's an extra piece of KeyStroke I need to make sure I put into the translated version, because we're apparently using it. |
(And yes, after I got my first Mac build done last night, I realized - DUH - that I could debug 95% of this by just making a 'Windows' version of the Input Classifier to swap some keys) |
DONE! And works on wife's actual Mac. Will deserve a beta, but that's what 3.3.3 is planned to have anyway. |
Looks good, I left a few minor suggestions, and if you could change the base class for the unit tests |
@Cattlesquat Have a look at PR #109. It has bootstrap.sh, which you can run to download and the JDKs needed for packaging, and it also downloads and compiles a current version of dmg. |
This latest attempt to merge appears to have "deleted the entire project" in this branch. Need to figure out how to rewind. |
@yanlyub uh.... I most definitely did not mean to "close this". I was trying to get rid of the part where somehow merging deleted the whole project. Any hints? |
Hmm. Let me mess with this, as I was hoping to look at this next. |
Yeah it all seemed fine until I tried to merge 13196 into it after you merged that. |
And then I tried to rewind it but apparently not the right way. |
I still have "the source code" from it on my Linux virtual machine, and I was able to cram it into the Bugfix13197 branch on github "Cattlesquat" fork. But that didn't update the PR the way it normally does. I should probably just stop touching anything related to this until you guys figure it out. |
PR #110 has a raw push of what I had on this in the other branch, right as I finally finished and built it the other day. It's obviously probably got everything "in the wrong directories" and what not. But it's there "just in case". |
Stage 1 - This should clean up the rest of the Mac Mouse bullshit and add the legacy preference. Keyboard shortcuts will be more of a bear.
Rather than have methods named e.g. "isRightMouse" but they lie to us and screw with our heads when we deal with Macs (wait, does "Control" mean "Control" right now, or does "Control" mean "Command"?), I have created names that hopefully are both understandable when read by a non-initiate but also "different enough" to remind us they have special meaning (and let us keep things straight in our heads when dealing with Macs).
SwingUtils.isVanillaLeftButtonDown() -- is left mouse button down ("except on Mac when it's pretending to be right mouse")
SwingUtils.isContextMouseButtonDown() -- is right button down (OR on Mac is left button pretending to be right button)
SwingUtils.isSelectionToggle() -- normally "Ctrl+LeftClick" on non-Macs. Other things on Macs, depending on "stuff".
SwingUtils.isShortcutKeyDown() -- ... in development. Name may slightly evolve if my needs do. Normally "Ctrl". On Mac usually "Command" but when legacy pref "Control"
This was the easy part, partially because of all the work done on this for 3.3.2.
Beating the keyboard shortcuts into line is going to be more "uncharted territory" so a good thing for me to work on ... tomorrow!