Feature "Click to continue" when minimized gives OS prompt.

mstieler

Member
Here's what I 'm hoping could be implemented:

If Mafia isn't the main window (say you're automating things, and decide to go surf the web or whatnot), and you get a "manual control" choice/prompt/error/etc (where Mafia would got red/orange and stop doing things), the taskbar spot for Mafia would flash to show something's happening (as in you start Mafia, minimize it while it's logging you in, running breakfast, etc.).

If you'd like more clarification of what I'm hoping for, let me know.

Edit: Screenshot added, because why not:
Mafiapic.jpg

What a Vista taskbar would look like when Mafia wants your attention and isn't "on top".
 
Last edited:

fronobulax

Developer
Staff member
Well I'm not sure how I would implement it and even if I did I have absolutely no confidence that my solution would be OS independent.
 
There isn't a good OS-independent way of handling this... but you COULD have Mafia throw up a normal Java dialog, with Always On Top property set to true. Sure, it's not the prettiest fix, but it works.
 

matt.chugg

Moderator
if you set kolmafia to minimise to tray, it shows a bubble alert above the tray when requests are complete. I couldn't get this to occur with an abort, but perhaps since it does it for adventuring complete it could be enhanced for other alerting?

I did a screenshot of what I mean, (and cropped it) but for some reason the forum won't allow me to upload .png files!

com.jeans.trayicon might be the best place to start, although am I the only person on windows who looks at the src at all, arn't you guys all on macs?!

it may be a case of calling:

Code:
	/**
	 * Display a balloon message for the icon
	 */
	public final static int BALLOON_NONE = 0;
	public final static int BALLOON_INFO = 1;
	public final static int BALLOON_WARNING = 2;
	public final static int BALLOON_ERROR = 3;
	public final static int BALLOON_NOSOUND = 0x10;

	public void showBalloon( final String msg, final String title, final int timeout, final int flags )
		throws TrayIconException
	{
		if ( WindowsTrayIcon.showBalloon( this.m_ID, msg, title, timeout, flags ) == 0 )
		{
			throw new TrayIconException( "Error showing Balloon message" );
		}
	}

Snippet from requestThread

Code:
		if ( KoLmafia.getLastMessage().endsWith( "..." ) )
		{
			KoLmafia.updateDisplay( "Requests complete." );
			SystemTrayFrame.showBalloon( "Requests complete." );
			RequestLogger.printLine();
		}

Sorry, but its 9pm, and i'm still at work, i'll try and look at this tomorrow if its considered an acceptable solution.
 
Last edited:

mstieler

Member
Well I'm not sure how I would implement it and even if I did I have absolutely no confidence that my solution would be OS independent.
It's been a long time since I was on a Mac, and I haven't done anything on Linux or whatever other OSs there are out there. I'd be very happy with a Windows fix :D
I did a screenshot of what I mean, (and cropped it) but for some reason the forum won't allow me to upload .png files!
You could upload the screenshot to a hosting site like I did. I had the same issue trying to attach the above pic as jpg or png.
 

fronobulax

Developer
Staff member
Veracity and (I believe) hola use Macs. There are mafia users on Mac, Windows and *nix and you can rest assured that if I committed anything that worked on Windows and did not work on, or worse yet broke something on a Mac my commit would be reverted before it was picked up by the RSS feed.

I'm relying on memory, but I was pretty sure that the minimize to system tray behavior of mafia was a PITA to get in an OS friendly way so I'm kind of presuming this would be similar. If anyone can get a pure Java solution that comes close then I'm sure it would be tested and committed.
 

matt.chugg

Moderator
Veracity and (I believe) hola use Macs. There are mafia users on Mac, Windows and *nix and you can rest assured that if I committed anything that worked on Windows and did not work on, or worse yet broke something on a Mac my commit would be reverted before it was picked up by the RSS feed.

I'm relying on memory, but I was pretty sure that the minimize to system tray behavior of mafia was a PITA to get in an OS friendly way so I'm kind of presuming this would be similar. If anyone can get a pure Java solution that comes close then I'm sure it would be tested and committed.

The fix I was talking about is already implimented in mafia, the function just needs calling from various events, I looked at a couple of stackoverflow posts, and they say that calling toFront on a minimized frame should make it flash...
 

fronobulax

Developer
Staff member
The fix I was talking about is already implimented in mafia, the function just needs calling from various events, I looked at a couple of stackoverflow posts, and they say that calling toFront on a minimized frame should make it flash...

Sounds like you may write the patch then ;-)
 

Theraze

Active member
Would calling toFront if not minimized but in the background make the window flash, or would it make it go to the foreground/front?
 
Top