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

Running apps via pkexec results in pkexec window not receiving the focus #117

Closed
monsta opened this issue Jun 26, 2014 · 13 comments
Closed

Comments

@monsta
Copy link
Contributor

monsta commented Jun 26, 2014

Steps to reproduce:

  1. Save the script from this page, make it executable, run it.
  2. Alt-Tab away from it.
  3. Alt-Tab back into it.
  4. Click on the button.
  5. The pkexec window is not focused while it should.

Note: in some cases (e.g. if you run the script with "&") it might require a second consequence of alt-tabbing away/back and the following button clicking in order to reproduce the issue consistently.

This issue can be reproduced in:

  • Linux Mint 17 with MATE 1.8
  • Linux Mint Debian Edition (LMDE) with MATE 1.6
  • Debian Testing with MATE 1.8

This issue can't be reproduced in Cinnamon or Xfce. Moreover, if you replace Marco with e.g. xfwm4, the issue can't be reproduced too. So I concluded this is a bug in Marco.

However, it can be reproduced if you replace Marco with Metacity, which might indicate this is a legacy bug.

@infirit
Copy link
Contributor

infirit commented Jun 26, 2014

I am missing the reason why it should not have focus? What is the logic for it not to have focus?

@infirit
Copy link
Contributor

infirit commented Jun 26, 2014

Here is how it works for me on gentoo.

Scenario one:

  1. Run the script and gets focus
  2. Click on the button, dialogue window gets focus

Scenario two:
1.Run the script and gets focus

  1. Alt tab to a different window, script lost focus
  2. Alt tab back to script and gets focus
  3. Click on the button, dialogue window has no focus.

And to be clear, the dialogue you need to enter your password in is from polkit-mate-authentication-agent-1. Can you also check this is the one that is running on your system?

edit: Also try to run another program that is not in sbin to see if that makes a difference.

@monsta
Copy link
Contributor Author

monsta commented Jun 26, 2014

It should have focus immediately after launching it. It does so in Cinnamon and Xfce, it doesn't in MATE, and that's the problem.

In particular, the starter of this thread is explaining why it's important for pkexec window to receive focus:

it is not active, so when you type your password it gets typed on whatever other window is active, and if that happens to be a text editor or field of some kind then your password will be shown.

@monsta
Copy link
Contributor Author

monsta commented Jun 26, 2014

Yes, this dialog is from polkit-mate-authentication-agent-1.

@infirit
Copy link
Contributor

infirit commented Jun 26, 2014

Ah, in your problem description you say in the last step it should be un focused so you may want to edit it and clarify 😉. I mean I though the problem was the other way around based on it.

@monsta
Copy link
Contributor Author

monsta commented Jun 26, 2014

Wait, but these are the steps to reproduce the bug, so the un focused is what you should get if you manage to reproduce it...
Besides, the title states it too: we're not receiving the focus, this is the issue, that's all. :)

@infirit
Copy link
Contributor

infirit commented Jun 26, 2014

I changed it and made it clearer what happens and what is expected. Yes they are the steps to reproduce but in the last step you indicate what you expect is an unfocused window which is contradicting the title 😄

@monsta
Copy link
Contributor Author

monsta commented Jun 26, 2014

Ok, maybe it's even better that way. :)
Hope you'll find the cause of the issue soon...

@monsta
Copy link
Contributor Author

monsta commented Nov 12, 2014

Interesting, this still happens in Metacity 3.14.1 (though I had to use gnome-flashback session instead of MATE due to one nasty quirk in the latest Metacity). Disappointing, I was hoping to cherry-pick some commits to fix this issue in Marco :)

@HuangZhiquan
Copy link

ah, i want to know the cause of the issue,why they can not drag the focus

@monsta
Copy link
Contributor Author

monsta commented Apr 10, 2015

Hehe, if we only knew the cause, we'd probably fix the problem right away... :)

BTW, I found out it also happens when using Gnome's polkit agent instead of MATE's one. Though their code isn't really maintained these days...

@alecz20
Copy link

alecz20 commented Aug 14, 2015

For what it's worth I am able to reproduce this in Ubuntu Mate 14.04 with the following simple steps:
1 - Open terminal
2 - enter pkexec pluma or synaptic-pkexec
3 - notice that the authentication window is not focused and anything you type appears in the terminal

What I also noticed is that once you manually click the authentication Window to get focus, the next time you call pkexec, it will give you the focus so long as you don't select another application. To reproduce the issue again, you have to first activate another window and then run pkexec. This might explain why the issue is not reproducible 100%, but I am able to reproduce it every time with this trick.

According to this: https://bugzilla.redhat.com/show_bug.cgi?id=614175, this is a Window Manager bug
I don't remember this being an issue in Ubuntu 10.04

I found that the same issue occurs with compiz but not openbox or xfwm4

@monsta
Copy link
Contributor Author

monsta commented Aug 18, 2015

Ok guys, if you know how to patch & build packages, please check if mate-desktop/mate-polkit#22 fixes the problem for you.

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

Successfully merging a pull request may close this issue.

4 participants