ID:2577885
 
Descriptive Problem Summary:
My cursor stops working in the map region of the UI at random.

Numbered Steps to Reproduce Problem:
???
???+1. Mouse left click bugs out and stops working in the map region.

Code Snippet (if applicable) to Reproduce Problem:


Expected Results:
It should work.
Actual Results:
It doesn't work.
Does the problem occur:
Every time? Or how often?
Randomly. Some days it's fixed by restarting my laptop, others (like right now) it persists even after restarting and reinstalling byond.
In other games?
I tested this on Eternia and Azusa as well and they don't work either (I can't click on the login page they have to join the game because they only have the map UI element).
In other user accounts?
I have only tested my account.
On other computers?
I only have this laptop to test on, however, this bug is so old, my bug report was deleted and back then I think I said it happened on my desktop PC like once. I cannot test it on both at the moment, however.

When does the problem NOT occur?
When the bug is not present, also it seems to occur less on release Byond, but I can't tell because it's a rare bug.

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)
More than a year and a half ago I still had the bug which is when I posted the bug report that is now deleted.

Workarounds:
Restarting my laptop usually works, but this time it didn't.

Additional notes:

VIDEO 1 DESCRIPTION
This is a video of about 20 minutes ago on an SS13 server. https://streamable.com/v84tgg

As you can see in the video, the cursor itself bugs out and adopts the texture of whatever it was last (if I move the arrow cursor fast enough, it doesn't trigger the resizing cursor). This doesn't happen when the cursor works properly.
What I'm doing in the video is constantly shift-clicking which calls the verb "examine" which you can see me do manually by right clicking, which works(EDIT: apparently OBS doesn't record the context menu so you can't actually see it, but you can probably notice the right click->shift right->shift right->click movement of the cursor, and then it immediately disappearing). I spam click the left mouse button with shift pressed which causes me to teleport over to the tile (shown as "now following X"). Even without pressing shift, it still doesn't work. Byond seems to recognize that I'm pointing at the object because it shows its name in the lower left.

Also, right clicking and examining the space tile deletes the cursor texture until I go into the menu on the right and trigger a cursor texture refresh.

VIDEO 2 DESCRIPTION
EDIT: This is a new video just now of the "Sometimes the cursor shows a loading circle and just glitches up and down every 1.5 seconds" problem.
https://streamable.com/ktnjye

It seems this glitching is fixed by moving the cursor over to the stat panes on the right and then it reverts to the behaviour described above.
The start of the video shows how the glitching cursor's "refreshing" behaviour resets the pointed object label on the lower left corner. If I keep it within the same tile, even if moved, it stays empty, if I switch between tiles, it refreshes but disappears on the next cursor glitch cycle.
You can again see me doing right clicks and "examine" or "point to" and the cursor disappears, but the glitching thing refreshes it almost immediately so it appears again.

LAPTOP DESCRIPTION
My laptop is a Surface Book 2. This bug persists through tablet and desktop mode, full performance and battery saver, mouse driver disabling and enabling, touchpad, peripheral mouse and windows updates.
I've never ever had a problem in any other application.


If you need any other information, I'll record more. I suspect byond is capturing some mouse state that is bugging it out but I don't know if there's anything that lets you check mouse states to compare.

I've moved this to BYOND Help because 1) it doesn't appear to be a BYOND bug, and 2) since you labeled this as happening in 512, it definitely doesn't belong in Beta Bugs.

As it stands I don't have nearly enough information to reproduce the problem, if it's possible to reproduce it at all. My gut says something on your computer is interposing itself in front of the BYOND window and swallowing all the mouse clicks, because there's no other explanation that would make sense. (Alternatively, it could be a misguided attempt by the UI for a specific game to put a transparent control in front of the map. However the fact that this occurs in multiple games rules that out.) Mouse behavior is baked in at a very basic level, so this isn't the kind of thing that could just happen due to an error in the code.
In response to Lummox JR
Lummox JR wrote:
I've moved this to BYOND Help because 1) it doesn't appear to be a BYOND bug, and 2) since you labeled this as happening in 512, it definitely doesn't belong in Beta Bugs.

As it stands I don't have nearly enough information to reproduce the problem, if it's possible to reproduce it at all. My gut says something on your computer is interposing itself in front of the BYOND window and swallowing all the mouse clicks, because there's no other explanation that would make sense. (Alternatively, it could be a misguided attempt by the UI for a specific game to put a transparent control in front of the map. However the fact that this occurs in multiple games rules that out.) Mouse behavior is baked in at a very basic level, so this isn't the kind of thing that could just happen due to an error in the code.

I guess I messed up the label, but it doesn't matter, it's a widespread issue regardless of the version.
What exactly could be interposing itself? Right click context menu works, the stat panel works, object hover detection works, more importantly double click works which is directly tied to the server code executing the teleportation proc, so it does go through somehow. I don't see what could be blocking single mouse clicks on my side when it doesn't happen on anything else and a restart sometimes doesn't fix it.

As for information, if you have any diagnostic script or want to compile a byond version with a small info window on the side outputting mouse state or whatever, or any third party software, I'm fine with running it.
There's a program called WinSpy that you can use to monitor messages to an app, that should be able to tell you what's going on with the button-down process.

Everything you described is consistent with another piece of software on your system stealing or breaking the left click. Other mouse messages including right clicks and double clicks are getting through, and those are all different messages from WM_LBUTTONDOWN.

The fact that this only happens on a window using DirectX also tells me that whatever is messing with the clicks is likely tied into gaming somehow. I'm curious what would happen if you opened an icon file in Dream Maker and tried to do editing there. The main icon grid and also the canvas and movie portions of the pixel editor are DirectX controls as well, so I would expect a similar problem to happen with them.

Another thing worth trying is creating a BYOND world that spits out output for all of the mouse messages, and seeing if MouseDown and MouseUp are received at all. Maybe what's messing with the game is taking both WM_LBUTTONDOWN and WM_LBUTTONUP.
Alright, probably won't have time to do everything as I'll be quite busy in a few days, but I'll report back in a month at the latest. Thanks.
Probably at the top of the list you should thoroughly check for any malware on the system.
Yeah, I was thinking it could be that, but I run Windows Defender and don't meddle around dangerous stuff. I'll still run a few scans and see what comes up. Could be something attaching to a vulnerability in DirectX.
My best guess is it would be something ostensibly harmless that doesn't mean to be interfering and is meant to do something helpful in games, but is interacting badly with BYOND.
I'm back now and will be monitoring the game when I can for the bug to occur.
Alright, so the bug is occuring right now. I used https://secure.byond.com/developer/Woo/MouseMovement to test the byond portion.

1. Dream Maker icons and map editing work perfectly everywhere, no problems there.

2. MouseUp, MouseDown and DblClick work fine. They give the object clicked, the location, etc.
MouseDrag and Click() DO NOT work. I believe that's where the problem lies. SS13 does not use MouseUp or MouseDown from what I can see or I haven't been able to find it.

As for other games, I don't know where to look for their code, but since I tested it on that MouseMovement example posted earlier, I assume it works for any game and server on byond.

That is, the whole problem is with Click() and MouseDrag() (which I assume uses Click()), and this problem should be universal to any game and server on Byond.

I've been looking into 3rd party tools to hook into the windows mouse events, but I haven't been able to use them yet. In any case, since MOuseUp and MouseDown actually work, it doesn't appear to be anything hijacking the mouse events. From what I understand, windows sends button up and down events to the window handler and the actual click registering is in Byond's code.

If you believe this could be external, I'll look around, and if you need something specific, I'll provide it.
If MouseDown and MouseUp are received, then Click should be for sure--unless your mouse is moving during the click, which should initiate a drag.
But then why is MouseDrag not being called?
I don't know what to tell you, I tested it and neither Click() nor MouseDrag() are called. I just put a world output at the very start of the procs and they don't output so they aren't called.
I don't know why I said MouseDrag uses Click when it should be MouseDown. It makes no sense to use Click.

I also tested MoseDrop and MouseWheel just now and MouseWheel works, but MouseDrop does not. I suppose MouseDrop requires dragging to have been active beforehand, but since MouseDrag is never triggered, MouseDrop won't be either.
Okay so I went ahead and tested a few things.

Code I used is modified MouseMovement mentioned earlier. I deleted all the click handlers and wrote these:
client
MouseUp()
world << "CLIENT UP"
..()
MouseDown(loc, con, params)
world << "CLIENT DOWN" + params
..()
Click()
world << "CLIENT CLICK "
MouseWheel()
world << "CLIENT WHEEL"
..()
MouseDrag()
world << "CLIENT DRAG"
MouseEntered()
// world << "CLIENT ENTERED"
MouseExited()
// world << "CLIENT EXITED"
MouseMove()
// world << "CLIENT MOVED"
MouseDrop()
world << "CLIENT DROP"
DblClick()
world << "CLIENT DOUBLECLICK"
..()
atom
MouseUp()
world << "ATOM UP"
MouseDown(loc, con, params)
world << "ATOM DOWN" + params
Click()
world << "ATOM CLICK "
MouseWheel()
world << "ATOM WHEEL"
MouseDrag()
world << "ATOM DRAG"
MouseEntered()
world << "ATOM ENTERED"
MouseExited()
world << "ATOM EXITED"
MouseMove()
world << "ATOM MOVED"
MouseDrop()
world << "ATOM DROP"
DblClick()
world << "ATOM DOUBLECLICK"

The commented outputs are because of spam, but they do output correctly (both client and atom do).

From the tests I ran, I got output:
CLIENT DOWNmapwindow.map
ATOM DOWNicon-x=6;icon-y=9;left=1;screen-loc=16:6,14:9
CLIENT UP

, and another person I asked to test (who did not have any problems) got:
CLIENT DOWNmapwindow.map
ATOM DOWNicon-x=21;icon-y=9;left=1;screen-loc=6:21,9:9
CLIENT UP
ATOM UP
CLIENT CLICK


As you can see, I don't get click or atom up, but I do get atom down. So there seems to be some asymmetry in this bug.
Testing isn't as thorough because I forgot to call atom Click from client, but it should in theory be called when it works normally.

I must also mention that doubleclick works on client and atom, and mousewheel only works on client.

I'm pretty curious what exactly is going on here. If you need more testing, I'll do it.
Client up should always call atom up, but that happens on the server. The click is generated on the client end after the mouseupl.
I checked Windows event log and saw nothing relevant to this. Does Byond have an error log? I can attach it here if it's encrypted or paste any errors I find.

As for the tests, we both did compile and run straight out of DM with the same code and got different results. I don't know how client/server works exactly for compile and run, but I hosted through DD and then joined and got the same result (I should have hosted and had the other person join, but it would have been the same. SS13 servers are at their base the same click code and they don't work).

I also tried looking into this client always calling atom, but I'm not clear on the details. I removed the parent call in the client and atom is never called. Not sure if that's what you mean. In both hosted and compiled and ran, atom is never called unless specifically invoked by client.

I then restarted my machine and tried all this again. In both hosted and compiled and ran, I get clicks, scrolls, drags and drops, everything works fine, and I get the same output as the reference person in my previous post.

So, considering all this, what exactly could be causing this behaviour? Is it external? If Windows is sending only button up and down events to Byond and Byond interprets the click behaviour, and mouse up and down is registered correctly in client but not atom, and all the other clicks tested output what is mentioned above, then what is going on?
Have you by chance tried a different mouse?
This is on my touchpad, but I also tried a peripheral mouse. Nothing works. I suppose it's possible the peripheral mouse is broken as well, but I literally never get any mouse problems other than in Byond.
Frankly the behavior you're seeing from the mouse is not even possible, unless something is massively interfering.

Clearly the client event is being reached, so ..() should be calling the atom event without fail. However, one thing you should do is print out all arguments from the mouse verbs, not just the params. Maybe there's something in there that your limited output didn't show.
I'm wondering if his touchpad software is conflicting. I had an issue with Synaptics touchpad software at one point that was making clicks act weird.