Skip to content
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

Child window steals focus #417

Closed
psouza4 opened this issue Jul 24, 2015 · 6 comments
Closed

Child window steals focus #417

psouza4 opened this issue Jul 24, 2015 · 6 comments

Comments

@psouza4
Copy link
Owner

psouza4 commented Jul 24, 2015

Originally reported on Google Code with ID 417

What steps will reproduce the issue?
Enable automatic mode.
Enable confirmation dialog.
Let MCM run, and continue with your work, e.g. write an email.
MCM will pop the confirmation / IMDB Id dialog, steal focus, and the keystrokes of
the email you were typing is now intercepted by MCM.
E.g. as you are about to hit enter the MCM dialog pops, gets the enter key, and you
just confirmed something without knowing what is is.

What is the expected output?  
For usability improvement Windows Vista made specific API changes to not allow a non-foreground
window from changing the focus.
There are workarounds that apps deploy to foil this, but it is not recommended as it
leads to usability problems.
Per Windows design guidelines a window that requires attention can make itself foreground,
or flash, but all that will happen is the taskbar will flash. 

A secondary problem is window placement.
A child window must default to being displayed centered on the parent window.
In MCM the child window is always centered on the primary desktop, wrong.
E.g. I run MCM on my secondary monitor while I work on the primary. MCM is supposed
to open child windows centered on the parent window, on my secondary monitor, instead
it open them on my primary monitor.


What do you see instead?
The window steals focus while I am typing.
The window is displayed on the primary monitor, not on the parent window.

What is the exact version of the Media Center Master that you using?
1.28.35710.1128

With what media software? 
XBMC


Please provide any additional information below:
See forum:
http://forums.mediacentermaster.com/viewtopic.php?f=6&t=1979&p=9722#p9722

Reported by pieter.viljoen on 2011-01-04 22:20:50

@psouza4
Copy link
Owner Author

psouza4 commented Jul 24, 2015

If you have specific references for best-practices cases with window placement and appearance,
I'll happily review them.

As it stands, Media Center Master is using the 'DefaultPlacement' property for pop-up
windows placement and 'Form.Show()' to show some windows and 'Form.ShowDialog()' for
model windows that don't allow interaction with the rest of MCM while open.  These
are all stock .NET methods from stock objects in the framework.  From your report,
it sounds like you're under the impression that MCM employs workarounds to get around
Windows usability improvements, but I can assure you that no such measures are taken.

Reported by psouza4 on 2011-01-26 21:19:11

  • Status changed: WaitingMoreInfo

@psouza4
Copy link
Owner Author

psouza4 commented Jul 24, 2015

I can't find any references, right now, that site best practices, but would you not
agree that stealing focus is bad?

I don't know about .NET, but in C++ you need to circumvent the default system behavior
that prevents focus stealing.

Regardless of the coding technology, the application should behave "cooperatively",
and not "aggressively".

Here are some references discussing stealing focus:
http://blogs.msdn.com/b/oldnewthing/archive/2008/08/01/8795860.aspx
http://en.wikipedia.org/wiki/Focus_stealing#Microsoft_Windows
http://xphelpandsupport.mvps.org/how_do_i_prevent_applications_fr.htm
http://www.eggheadcafe.com/software/aspnet/34993615/window-zorder.aspx
http://msdn.microsoft.com/en-us/library/ms632599(VS.85).aspx#foreground

Reported by pieter.viljoen on 2011-01-26 21:45:42

@psouza4
Copy link
Owner Author

psouza4 commented Jul 24, 2015

I don't necessarily disagree on how an application *should* preform -- I'm responding
first to the implication that it's intentional or that MCM goes out of its way to do
so.

However, that said -- it seems that you have to go out of your way to *not* do it in
C#:

http://stackoverflow.com/questions/156046/show-a-form-without-stealing-focus-in-c

Reported by psouza4 on 2011-01-27 00:02:54

@psouza4
Copy link
Owner Author

psouza4 commented Jul 24, 2015

Incidentally, I did add the override code to prevent forms that pop-up from stealing
focus.  I made a blanket change to all of these types of forms, but have not tested
every condition that they occur in (I use a lot of 'please wait' type conditions).
 Of the tests I performed, the focus was not stolen in any case.

Fixed and waiting for next release.

Reported by psouza4 on 2011-01-27 00:14:03

  • Status changed: Fixed
  • Labels added: Type-FeatureRequest, Component-Functionality, Usability
  • Labels removed: Type-Unsorted

@psouza4
Copy link
Owner Author

psouza4 commented Jul 24, 2015

Thank you.

Reported by pieter.viljoen on 2011-01-27 00:20:54

@psouza4
Copy link
Owner Author

psouza4 commented Jul 24, 2015

Released in version 1.29.2711.620.

Reported by psouza4 on 2011-01-27 17:36:17

  • Status changed: Fixed-Released

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant