Closed
Bug 50130
Opened 26 years ago
Closed 25 years ago
A more efficient way for implementing widget/src/gtk/GetShellWidget()
Categories
(Core :: XUL, defect, P3)
Tracking
()
RESOLVED
FIXED
People
(Reporter: b84118, Assigned: masaki.katakai)
References
Details
Attachments
(2 files)
|
2.54 KB,
patch
|
Details | Diff | Splinter Review | |
|
7.03 KB,
patch
|
Details | Diff | Splinter Review |
To find the shell widget, we can use gdk_window_get_toplevel() to avoid
repeatedly retrieving user_data by gdk_window_get_user_data() and
gtk_object_get_data():
static nsWidget *
GetShellWidget(GdkWindow *gdkWindow)
{
GdkWindow *parent = gdk_window_get_toplevel(gdkWindow);
nsWidget *root_win = nsnull;
gpointer data;
if (parent != gdkWindow) {
gdk_window_get_user_data(parent, &data);
if (GTK_IS_OBJECT(data)) {
root_win = (nsWidget *) gtk_object_get_data(GTK_OBJECT(data), "nsWindow");
if (root_win)
return root_win;
}
}
return nsnull;
}
This code seems to work for me, please take a look and decide if it's ok to use
it.
Thank you.
| Reporter | ||
Updated•26 years ago
|
Target Milestone: --- → M17
Comment 1•26 years ago
|
||
unsetting target milestone. Target Milestone is reserved for developer triage.
Target Milestone: M17 → ---
Updated•26 years ago
|
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Comment 2•26 years ago
|
||
The code in the comment has been tested. Ready for check-in.
r=pavlov@netscape.com is wanted.
Target Milestone: --- → M19
Comment 3•26 years ago
|
||
the code looks fine to me. r=pavlov
Comment 4•26 years ago
|
||
Interesting. It looks ok for what it is supposed to do.
While I have the chance though I'd like to ask what happens in the case where
the top level window is not a mozilla window. This happens in the case where
mozilla is embedded in another application. I get tons + tons of asserts from
the GetShellWidget() code in my embedding app and it drives me up the wall. Is
there any way that we can clean up those problems while we are at it? Maybe at
least not make it an error condition?
Comment 5•25 years ago
|
||
blizzard, what kind of application are you
embedding mozilla? Nautilus?
| Reporter | ||
Comment 6•25 years ago
|
||
I guess that every gtk embedding application will be affected, since
gdk_window_get_toplevel() will return the outmost GdkWindow, which is
not necessarily owned by mozilla.
I not quite familiar with XIM programming model, therefore I don't know
whether the shell window responsible for handling XIM should be the
outmost window of the *entire* application or just that of mozilla. I will
propose a better solution after I figure out how to get the correct shell
window that mozilla needs for XIM input.
Comment 7•25 years ago
|
||
Nautilus is one of the conusmers of it, yes.
| Assignee | ||
Comment 8•25 years ago
|
||
I tried TestGtkEmbed, but IME didn't work on it.
XIC is never created because GetShellWidget()
returns null as you commented. GetShellWidget() should
be changed for GtkEmbed.
I talked with Tajima-san (he is in japan now) and
we found a solution that we can use the most parent
(ancestral) nsWidget as nsIMEShellWidget. That nsWidget
has a native GtkWindow which will be embedded. I will attach
the patch for nsWidget.cpp. Does this make sense?
I'm not sure that embed feature also will be into RTM.
Do you think this problem should be fixed by RTM?
Should we continue to use this bug id? or need new one?
| Assignee | ||
Comment 9•25 years ago
|
||
Comment 10•25 years ago
|
||
The best way to actually get the outermost mozilla window is to use
nsWindow::GetMozArea(). Not only does it locate the outermost Mozilla window
but it's cached after it is called once so repeated calls will be very fast.
Why isn't this code in nsWindow, anyway? Is there some reason all of this XIM
code isn't?
| Assignee | ||
Comment 11•25 years ago
|
||
Thanks for suggestion. I've verified GetShellWidget() and
GetMozArea() (+ get nsWindow object) return the same result.
We should use GetMozArea(). I'll make a patch.
| Assignee | ||
Comment 12•25 years ago
|
||
| Assignee | ||
Comment 13•25 years ago
|
||
I've attached the 2nd patch,
mozAreaWindow = (nsWindow *)gtk_object_get_data(GTK_OBJECT(top_mozarea),
"nsWindow");
GetMozArea() and gtk_object_get_data() can return the shell
widget, which can be used for GtkEmbed also. We can remove
GetShellWidget() codes from nsWidget.cpp now.
Comment 14•25 years ago
|
||
Adding Adrian. Adrian, can you have a look at this patch, too?
Comment 15•25 years ago
|
||
It looks reasonable to me.
Comment 16•25 years ago
|
||
Code appears to work o.k. for me, and the IME problem appears to be fixed.
| Assignee | ||
Comment 17•25 years ago
|
||
| Assignee | ||
Comment 19•25 years ago
|
||
fix checked in as part of bug 53989.
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
| Assignee | ||
Comment 20•25 years ago
|
||
*** Bug 50403 has been marked as a duplicate of this bug. ***
| Assignee | ||
Comment 21•25 years ago
|
||
*** Bug 82138 has been marked as a duplicate of this bug. ***
Comment 22•25 years ago
|
||
*** Bug 81902 has been marked as a duplicate of this bug. ***
You need to log in
before you can comment on or make changes to this bug.
Description
•