VOGONS


First post, by emendelson

User metadata
Rank Oldbie
Rank
Oldbie

I've only seen this problem in my own project, which runs an application, not a game, so I don't expect any of the devs to respond unless the same problem occurs in games.

In both text and graphic modes, under every output= option that I've tried, the mouse cursor in my DOS program sometimes "stalls" near one of the edges of the window. In a VESA 1024X768 graphics screen, the mouse might stall two-thirds of the way down the window. I use a custom 43-line video mode (details in a moment), and sometimes the mouse stalls near the bottom, top, or right border. Sometimes, by moving the mouse in many directions, I can get it to move into the area where it wouldn't go before, but that doesn't always work.

The problem seems to vary slightly with different output= settings. I mostly use openglhq where the problem seems less bad than in other settings, but it occurs in all settings.

One of my users reports that he can fix the problem by clicking in the "DOSBox" string in the title bar of the DOSBox window. I can't reproduce that, but perhaps he is simply seeing the effect of moving the mouse around.

I see this problem in standard VESA modes and in my custom text mode. In int10_modes.cpp I've replaced mode 3 with this:

{ 0x003  ,M_TEXT   ,720 ,688 ,80 ,43 ,9 ,16 ,8 ,0xB8000 ,0x4000 ,100 ,688 ,80 ,688 ,0	}, /* EM mod! */

I've experimented by increasing the plength setting from 0x1000 to 0x2000 and 0x4000 (as it is now), but that was just an incompetent guess on my part, and didn't do any good.

I would be very grateful for any help with this.

Reply 1 of 5, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

What you describe sounds similar to what can happen when the mouse is unlocked, so make sure the mouse is locked. If you have autolock=false, you have to manually lock with Ctrl-F10; but with the default autolock=true you can just click on the DOSBox window to lock.

Reply 2 of 5, by emendelson

User metadata
Rank Oldbie
Rank
Oldbie

That's exactly right. Thank you. When I set autolock=true (or when I lock manually) the problem disappears.

Now to decide whether to make this the default and warn my users that they will either need to (1) unlock manually or (2) use Alt-Tab to shift focus to another window.

Here's a question related to this (I don't think this is serious thread drift, but I'm happy to start a new thread about it):

I also have a project that uses the SheepShaver emulator under OS X (another SDL-1.2-based project), and in that project I use some code (not written by me) that adds a message to the title bar saying something like "Cursor locked (press [whatever] to unlock". Is there an easy way to do the same thing in DOSBox, so that the title bar displays a message at all times that the mouse is locked? (That might be a useful thing to have in the standard build, perhaps.)

I've tried in the past to transfer some bits of SDL code from SheepShaver to DOSBox (or the reverse), but I don't know enough to get it right, so any pointers would be welcome. Thanks again.

Reply 3 of 5, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

To reflect the lock status in the title bar, I think sdlmain.cpp is the only source file you'll need to work with.

An example of manipulating the window caption, though not exactly what you want to do, may still be instructive: Title Bar

Reply 4 of 5, by emendelson

User metadata
Rank Oldbie
Rank
Oldbie

That will get me started; thank you. I think I see that I need to do two things, though I'm stumbling around ignorantly:

1. When DOSBox starts up, I need to test for sdl.mouse.locked (or SDL_GRAB_ON ??) and initialize the GUI with the message in the title bar.

2. I need to add to the mouse-grabbed-toggle routine (Ctrl-F10) something similar that re-initializes the GUI with the message added to or removed from the titlebar.

I'll struggle with this over the next few days, but if someone who knows what they're doing thinks this might be worth the trouble for other users, or perhaps for the main project, I'll be very grateful for any help.

Reply 5 of 5, by emendelson

User metadata
Rank Oldbie
Rank
Oldbie

EDIT: I've deleted this message, because I finally figured out how to get a "Ctrl-F10 releases mouse" message into the titlebar, and have posted the solution in another thread:

INPUT - Add "Ctrl-F10 releases mouse" to titlebar (SDL1)

For anyone who knows how to program, this will have been obvious, but for beginners like me, it may be useful.