NPAPI Safari persistent identifier for browser and tabs - macos

I have a Safari Extension and an NPAPI plug-in and am trying to get an identifier for both a browser and tab that is persistent across loads until the window/tab is closed. One of the objects that I use needs to look up a tab by some identifier. On our Windows implementation, they use windowing APIs to get the pointer to the window (to represent the tab) and walk up the parents list to get the top level window (to represent the browser).
Is there anything like this on Mac Safari?

There is no way to get a pointer to the browser's window in any Mac browser that runs plugins out of process (which includes 64-bit Safar), because windows aren't shareable across processes. Moreover, the concept seems deeply flawed on any platform; many browsers allow dragging a tab out of one window and into another. Do you want your plugin to suddenly believe it's in a new page in this case even though the user hasn't even reloaded the page?
I can't think of any way you can track tabs given that the API has no concept of tabs. I'd strongly recommend revisiting this requirement, given that it seems very arbitrary from a user perspective. (For example, if I reload a page, that's the same, but if I close a tab and then immediately re-open it using the browser's version of undo-close-tab, it's not? And as noted above, if I drag a tab between windows, the tab is somehow different?)

Related

Disable auto-raise windows in LibreOffice

Apologies if this isn't the right place to ask about LibreOffice, but I didn't see another site more appropriate.
If I have two LibreOffice documents open simultaneously with one overlapping the other, I find that floating my mouse pointer over the toolbar buttons in the background window (without clicking) brings that window to the foreground, covering the document I was trying to work with. But the focus doesn't change. If I type, those characters are typed into the now-in-back document window, not the one on front. It's super-annoying.
Is this a setting that I can disable? Usually, it's the window-manager that is in charge of raising windows, but LO seems to be doing it by itself.
When neither of the two document-windows has the focus (e.g. a web browser or whatever is in the foreground), the LO windows still behave the same way, but they do not come to the foreground... they just swap their foreground/background position relative to each other.
This is on LibreOffice 7.4.5.1, but it was happening with whatever version I just upgraded from as well (I upgraded to see if this was "fixed"). It was probably 7.2.something. I'm on x86-84 MacOS Ventura.

Are browser tabs child windows?

I've been recently dabbling with writing applications in win32 (i run win10). Windows has this concept of parent windows and child windows each of which can be customized to do various things.
What does this structure like in a browser like chrome/firefox? I read somewhere that browsers don't have a concept of "windows" in the win32 sense. However, Spy++ shows that each tab of a browser window has a unique window handle (likely for interfacing with windows). But the "tab handle" does not have any other children.
If we consider a webpage that is broken into multiple sections, each with its own scrollbar, how does the browser know which scrollbar is active? I imagine that the browser would likely use the mouse pointer location to figure this out once a scroll message (in the win32 sense) is sent to it.
Fundamentally, what kind of code structure do browsers use?
A related, albeit distant question- how is the scroll without focus functionality implemented in windows? I believe the answer to this leads from the first but if its not, I'll make this a separate question.
Thanks!
PS. I only know C++.
PPS. Links to resources that can get me started are just as important and much appreciated.

Options for getting/setting Windows window states for a browser window

Our agency has a Java web application that uses a third party Java applet as a TIFF viewer. In this application javascript spawns a separate window (and yes, it must be a separate window). We are currently using an in-house ActiveX control so that the HTML window can have the window state, window size and position, and screen device presisted and restored via localStorage. Our agency is IE11 only so for now using it is not a problem. It's embedded in the page and operates on the "containing window".
This control was made many years ago in VB6. It appears that Visual Studio doesn't support the creation of ActiveX controls, and I don't personally have the knowledge or skill to create one another way.
Please do not suggest the HTML DOM window and screen objects! Most answers I've searched for just refer to these! They can't get the entire browser window size (viewport + chrome + toolbars + titlebar), nor does javascript have any idea about Windows-specific things like window state and screen device (it's always the OS primary screen). I understand the HTML DOM can't be tied to anything OS-specific in order for it to be implementable on multiple platforms.
Up until now this control has worked pretty well - you can, for example, maximize on a given screen and restore the window to the same screen. But I realize that ActiveX won't be supported forever and it's IE only...It seems to me, though, that the need for such functionality can't be totally uncommon. I'm guessing that some may suggest that the application UI should be changed so that this is less of a problem - but being able to put the viewer on a different monitor from the application, and having that window be restored exactly to it's last position is important to us. I do understand that if you reuse that window the user only has to position it once, but we'd rather not require this of the user.
Question: are there any alternatives to interacting with the win32 API other than COM/ActiveX ? Are there any other methods of accurate window persistence that can know about screens other than the OS primary, and maximized/minimized/normal windows) that use something other than the Win32 API?

Is there a way to make the displayed tab in Firefox "follow" the opened Inspector window(s)?

When I am debugging frontend work, I frequently have multiple Inspector windows open at the same time, each inspecting a different page. As I change Inspector windows, I would like the displayed tab or window to follow me. In other words, I would like the browser to always automatically change to the page I am inspecting; I do not want to change Inspector windows, then go to the browser and find the corresponding tab or window myself.
Is this possible in Firefox? Is it possible in any browser?
(I realize I could dock the Inspector to each tab or window. I do not want to do that because I use the multiple Inspector windows side-by-side for comparison.)
While I am not aware of any way to switch to the target browser tab when selecting a given inspector window, you can certainly do it the other way around:
Say you have 3 tabs opened, and you have opened devtools for each them, in window-mode (undocked). Now, whenever you select any of these 3 tabs, if you just hit F12 (or ctrl+shift+I/cmd+alt+I), then the corresponding devtools window will be brought to the front.
That's an easy way to keep track of which devtools window is linked to which browser tab.
Now, doing this the other way around would require a new feature to be implemented. This can't really be automatic (or at least hidden behind a config of some sorts) because it could be considered frustrating to some users, having their current tab being switched away from each time they click in a devtools window.
I have filed this bug to get it done: https://bugzilla.mozilla.org/show_bug.cgi?id=1163646

How can I find out or record the X11 top-level window from which a top-level window was opened?

I'm thinking of writing an X11 window manager which does for windows something like what TabKit does for tabs in Firefox (in its default tree view mode). To do this, I'd need to be to able to find out which window a window was opened from. Is there a standard way of finding this out?
(I've never done any X11 programming without using a cross-platform toolkit on top of X11, let alone writing a window manager.)
For the difficult cases - applications launching other applications, e.g. a word processor launching a web browser - there's going to be a need for co-operation between applications to track this information. The Zeitgeist project already seeks to track which documents were opened from which documents, which is close enough that I should probably work with Zeitgeist (and/or its KDE equivalent - Nepomuk?) to get this implemented.

Resources