XULRunner's focus code doesn't play well with gtk on windows




10 years ago
2 years ago


(Reporter: ben, Unassigned)


Firefox Tracking Flags

(Not tracked)



(1 attachment)



10 years ago
User-Agent:       Mozilla/5.0 (X11; U; Linux x86_64; en; rv: Gecko/20080418 Epiphany/2.20 Firefox/
Build Identifier: 

I was trying to embed XULRunner in a GTK app that I was developing on windows.  However, the differences between XULRunner's and GTK's focus models make it very tricky to do.  The main problem is that GTK expects it's top-level window to have the the Window's focus at all times.  It tracks which child window has focus internally.  However, XULRunner takes the focus for itself and this leads to problems.

I'm not sure what the right way to fix this problem is.  Switching focus models seems impossible.  Maybe XULRunner could work with the GTK Plug/Socket interface?  Maybe there could be code in XULRunner to hack around the problems?  At the very least, the problems should be documented and steps should be given to work around the issues.

Reproducible: Always

Steps to Reproduce:

Comment 1

10 years ago
Created attachment 319334 [details]
Code to fix the problems

I'm attaching the code that I needed to write to make GTK and XULRunner work together.  It probably doesn't fix all the issues, but it's a start.  This code does a couple things:

1) When XULRunner has focus and the user clicks on a GTK widget, we have GTK focus it's top-level window.  Otherwise GTK widgets will not accept focus until we switch to a different app, then switch back.

2) When GTK's toplevel window loses focus to a XULRunner browser widget, we don't let GTK see the WM_KILLFOCUS message.  Otherwise it takes 2 mouse clicks for GTK to focus a widget after XULRunner has focus.

3) When the browser window is clicked on, we give the GTK widget that contains it focus.  Otherwise GTK will still think that it's currently focused widget still has focus.  For example if a GtkEntry widget was the last widget to have focus, then it will still display a blinking cursor.

Comment 2

2 years ago
Marking a bunch of bugs in the "Embedding: APIs" component INCOMPLETE in preparation to archive that component. If I have done this incorrectly, please reopen the bugs and move them to a more correct component as we don't have "embedding" APIs any more.
Last Resolved: 2 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.