Open
Bug 367760
Opened 19 years ago
Updated 3 years ago
style not attached correctly
Categories
(Core :: Widget: Gtk, defect, P5)
Tracking
()
NEW
People
(Reporter: chpe, Unassigned)
References
()
Details
1237 moz_gtk_tooltip_paint(GdkDrawable* drawable, GdkRectangle* rect,
1238 GdkRectangle* cliprect)
1239 {
1240 GtkStyle* style;
1241
1242 ensure_tooltip_widget();
1243 style = gtk_rc_get_style_by_paths(gtk_settings_get_default(),
1244 "gtk-tooltips", "GtkWindow",
1245 GTK_TYPE_WINDOW);
1246
1247 gtk_style_attach(style, gTooltipWidget->window);
1248 TSOffsetStyleGCs(style, rect->x, rect->y);
1249 gtk_paint_flat_box(style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_OUT,
1250 cliprect, gTooltipWidget, "tooltip",
1251 rect->x, rect->y, rect->width, rect->height);
1252
1253 return MOZ_GTK_SUCCESS;
the style is attached incorrectly; and also it's never detached again.
From gtk_style_attach docs:
Attaches a style to a window; this process allocates the colors and creates the GC's for the style - it specializes it to a particular visual and colormap. The process may involve the creation of a new style if the style has already been attached to a window with a different style and colormap.
Since this function may return a new object, you have to use it in the following way: style = gtk_style_attach (style, window)
Comment 1•17 years ago
|
||
I don't really understand why we need to reattach the style each tooltip paint... Is there a good reason ? In fact, why doesn't the tooltip widget get the correct style on its own ? Because it's a standard window ?
Comment 2•17 years ago
|
||
The point in attaching the style is that X related resources get allocated (it is realized as the widgets are). This will usually happen when the widget is realized. However in this case you are using gtk_rc_get_style_by_paths, and the returned style may note be realized yet, so it needs to be attached.
As you create a window for only the tooltips anyways, instead of getting the style with gtk_rc_get_style_by_paths.
The only thing needed would be a call to gtk_widget_set_name to set the correct name. Then the window has the correct name, and will get the correct style in the first place.
Comment 3•17 years ago
|
||
My question was twofold: Why do we need to reattach each paint (instead of once and for all), and why couldn't we manage to make the window get the correct style by itself... If setting the window name is the only thing we need to get the right style, I guess the first question is moot.
Comment 4•17 years ago
|
||
You could attach the style from gtk_rc_get_style_by_paths once and then cache the result. But if you did that, you would need to listen for theme change events and reget the style when needed ...
(btw. the current code also has the bug of not detaching the style again it seems)
Comment 5•17 years ago
|
||
ping so it move up on my radar.
Comment 6•6 years ago
|
||
Priority: -- → P5
Updated•3 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•