Managing browser window focus - browser

Parent window opens a child window.
User toggles to Parent window.
Can a button/link in the Parent window bring the child window into focus? (I tried a quick and dirty test and it worked in Safari in OSX...and it works) Will this work across Grade A browsers?
If the parent window is closed...
Can another window target the child and bring it into focus? Can another window close the orphaned child window?

Related

Keeping a Child window in place inside of a Parent Window x11 (linux)

I have a child window inside of a parent window.
Currently, when I scroll down the page of my parent window,
the child window stays on top and follows the scroll,
getting in the way of the text of my parent window.
Is there any way to set the child window in place
(through x11 or a toolkit)
so that it doesn't follow the scroll of the parent window?
(ie when I scroll downward, the child window would stay in place and would be off screen until scrolling back upwards)
Thank you in advance.

How to propagate the parent's click event in Pyside2 as if I have clicked the button directly while hovering over it?

How to propagate the parent's click event in Pyside2 as if I have clicked the button directly while hovering over it?
This is a very peculiar problem, and I haven't been able to find even a question like this.
A button is positioned on the main UI window. When clicked, it hides the parent window, and spawns another window at that position. I need it to work with a single click, for example, I want to press the button, and not release the mouse immediately, but hover over a certain part of the newly spawned window and then release it.
This works perfectly fine if I click the button directly , but the problem is I need to click the button from the main UI window.
I am doing it by sending "mousePressEvent" from the main UI window to the child widget's "mousePressEvent", like this:
def mousePressEvent(self, event): #parent mouse press event
#----
#----
self.FocusedButton.mousePressEvent(event) # child widget
When I activate the button from the mainUI window, the window is immediately hidden and the new window is spawned. However, since I haven't performed mouse release yet, I am stuck into the parent's mouse press event loop. The mouse doesn't invoke paint event and doesn't register mouseMoveEvent until I release the click because the mainUI window is hidden and mouse tracking doesn't work any more.
I have tried setting the flags of the window in every way, (QtCore.Qt.WA_TransparentForMouseEvents,True ) for example, but none of it worked.
The main UI window inherits from "QtWidgets.QWidget" and does not have the clicked method.

Finding what window the user is focused on in Xfce

when I play osu! on Linux the option to "confine mouse cursor to osu! window" does not work. This means that my mouse cursor will move to my other monitor when I am playing. This is an issue because if I accidentaly click one of my mouse buttons it will tab me out of osu! and I will fail the map.
I wanted to make a python script to check if the user is focused on the osu! window, and if they are, it would confine the cursor to that window, but I have no idea how I would check what window the user is focused on.

Managing focus between multiple CDHtmlDialog windows

I create a modal CDHtmlDialog as my root window, and then create a modeless CDHtmlDialog window. Based on the events, clicking between the two windows shifts focus, but the root window is always in the back. How do I fix this?
The modeless dialog is alway on-top of the the root dialog is because the modeless dialog is created as a child of the root dialog. You can change this by making the modeless dialog a child of the desktop window instead as follows:
m_MyModelessDlg.Create(IDD_DIALOG1, GetDesktopWindow());
m_MyModelessDlg.ShowWindow(SW_SHOWNORMAL);
Using the desktop didn't seem to help.. I suspect because of the behavior of CDialogs. I fixed it by creating a hidden, root window, and making all of my dialogs (CDHtmlDialog's) children of that.

wxPython on KDE 4.2: popping window on top of the screen and hiding back

I want my window to be invisible most of the time, but get to top of
the screen on hotkey and hide again if the user switches to another
application.
In my hotkey handler I use
self.Show()
self.Raise()
self.Iconize(False)
and in my activate message handler
self.Hide()
self.Iconize(True)
but the window pops up on top of the screen, but remains deactivated:
it's title bar colour is a inactive one, and it flashes in the taskbar
as a window requiring my attention and it doesn't get EVT_ACTIVATE. I
tried to add self.SetFocus, but no effect.
And if I use
self.Show()
self.SetFocus()
in hotkey handler and in my activate message handler
self.Hide()
and it works okay if I deactivate my window by clicking to another
window, but if I press Alt-Tab and then invoke my window with a hotkey
it doesn't appear on top of the screen but just flashes in the
taskbar. Also I made an ability to hide it by pressing a button on it,
and if I hide it this way, it also doesn't show correctly afterwards
as in the case with Alt-Tab
you have to use a window manager to activate windows. I'm using wmctrl for that purpose (cannot find the same func. through kwin's dbus for kde).

Resources