After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 73359 - statusbar text clipping leak on resize grip
statusbar text clipping leak on resize grip
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
1.3.x
Other Linux
: Normal minor
: ---
Assigned To: gtk-bugs
gtk-bugs
: 137107 (view as bug list)
Depends on:
Blocks: 137845
 
 
Reported: 2002-03-04 08:50 UTC by Michael Meeks
Modified: 2011-02-04 16:16 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Partial fix to get reasonable allocations. (Not applied to CVS) (2.07 KB, patch)
2002-03-21 21:28 UTC, Owen Taylor
committed Details | Review
Extension to testgtk (2.27 KB, patch)
2002-12-07 16:37 UTC, Soren Sandmann Pedersen
none Details | Review
The right patch (1.43 KB, patch)
2003-01-31 21:27 UTC, Soren Sandmann Pedersen
committed Details | Review
combined patch for statusbar and selectable label (5.29 KB, patch)
2003-05-17 22:22 UTC, Matthias Clasen
none Details | Review
remaining clipping problems (9.38 KB, image/png)
2003-05-17 22:23 UTC, Matthias Clasen
  Details
gtkresizegrip.h (2.57 KB, text/plain)
2003-07-31 20:54 UTC, Matthias Clasen
  Details
gtkresizegrip.c (12.11 KB, text/plain)
2003-07-31 20:54 UTC, Matthias Clasen
  Details
testgtk patch (5.44 KB, patch)
2003-07-31 20:55 UTC, Matthias Clasen
none Details | Review
screenshot (8.94 KB, image/png)
2003-07-31 21:30 UTC, Matthias Clasen
  Details
new version (12.63 KB, text/plain)
2003-08-06 22:19 UTC, Matthias Clasen
  Details

Description Michael Meeks 2002-03-04 08:50:32 UTC
The resize grip clips away / renders over the text underneath it - if you
have a long status message, but it leaves a few pixels of text visible to
the RHS of it in the status bar, which flickers strangely when you resize.

A minor moan of course.
Comment 1 Owen Taylor 2002-03-04 16:01:24 UTC
Sounds like a dup of bug 67972, which was closed because I
couldn't reproduce it any more.
Comment 2 Michael Meeks 2002-03-04 20:02:19 UTC
To reproduce run libbonoboui/test/test-ui and press 'Press me to test'
a few times until you get a grip and the "This is a very long
string..." blurb in the status bar, and give a bit of a gragging to
that resize grip.

HTH.
Comment 3 Owen Taylor 2002-03-21 21:27:40 UTC
Couldn't figure this out in a few minutes of looking at it.
The attached patch is probably needed as a start of fixing
the problem,since the label was getting completely bogus
allocations.
Comment 4 Owen Taylor 2002-03-21 21:28:19 UTC
Created attachment 7300 [details] [review]
Partial fix to get reasonable allocations. (Not applied to CVS)
Comment 5 Matthias Clasen 2002-04-05 13:33:48 UTC
Move open bugs from milestones 2.0.[012] -- > 2.0.3, since 2.0.2 is already out.
Comment 6 Owen Taylor 2002-06-12 22:00:00 UTC
Moving a number of non-critical or hard-to-fix bugs to 2.2.0
Comment 7 Owen Taylor 2002-10-24 16:58:52 UTC
Move various non-critical bugs onto 2.2.1 milestone.
Comment 8 Soren Sandmann Pedersen 2002-12-07 16:37:20 UTC
Created attachment 12818 [details] [review]
Extension to testgtk
Comment 9 Soren Sandmann Pedersen 2002-12-07 16:44:08 UTC
The patch I just attached extends the statusbar test in testgtk so that 
it gets a new button that pushes a long text on the statusbar. 

With this patch, a similar problem can be reproduced by using the
"Properties" tool to make the long label selectable, then select a
part of the label that extends beyond the resize grip, and finally resize
the window a bit. You can then see the blue select color between the
window and the resize grip.

In my opinion the best fix is to add a GtkResizeGrip widget in 2.4 and
then simply add that widget to the statusbar. That will get rid of 
the not-quite-sane hacks that goes on in statusbar_size_allocate().

A resize grip is useful outside of statusbars anyway.
Comment 10 Owen Taylor 2003-01-29 21:52:10 UTC
Looks like the wrong patch is attached above?

I don't think you can compatibly turn this into adding
a widget ... if you add extra things packed into the
status bar, you'll cause problems for people who are
already packing stuff in there.
Comment 11 Soren Sandmann Pedersen 2003-01-31 21:27:53 UTC
Created attachment 14004 [details] [review]
The right patch
Comment 12 Soren Sandmann Pedersen 2003-01-31 21:32:33 UTC
(I just attached the correct patch)

Maybe it would be possible to add an internal method on hbox, "put
this widget at the end, always". I think that would be a better
solution than more messing with hbox internals in gtkstatusbar.
Comment 13 Matthias Clasen 2003-05-17 22:17:43 UTC
Owen, your patch to get reasonable allocations fixes things as far as
the statusbar is concerned. The remaining problem is selectable labels
drawing the selection and the cursor outside of their allocation. The
following fix seems to fix the problems with text bits showing up to
the   right of the resize grip. It doesn't fix the problem that the
resize gri p should really be a shaped window (or be implemented
without any extra window).
Comment 14 Matthias Clasen 2003-05-17 22:22:25 UTC
Created attachment 16598 [details] [review]
combined patch for statusbar and selectable label
Comment 15 Matthias Clasen 2003-05-17 22:23:03 UTC
Created attachment 16599 [details]
remaining clipping problems
Comment 16 Owen Taylor 2003-06-03 23:41:28 UTC
Couple of comments about the GtkLabel patch:

+      clip = gdk_region_rectangle (&widget->allocation);
+      gdk_gc_set_clip_region (gc, clip);

Could use gdk_gc_set_clip_rectangle() instead.

+	  area = gdk_region_rectangle (&event->area);
+	  gdk_region_intersect (clip, area);
+          gdk_region_destroy (area);	  

Could just use event->region (which is also more exact
than the event->area bounding box.) Or did you mean 
widget->allocation?

For the remaining problems shown, it would be pretty
trivial to switch to an input-only window and drawing
on the parent window.  That could have the strange
effect of children of the statusbar going *over* the
resize grip if you had !NO_WINDOW children, like
GtkProgressBar (why didn't we fix that? Must have
forgotten about it.)

I don't think the shaped window is possible, since 
drawing the resize grip is themed, so it might not
follow the same pixels.
Comment 17 Matthias Clasen 2003-06-04 08:56:53 UTC
Wouldn't the "drawing over" simply be fixed by shrinking the child 
allocation to reserve room for the resize grip ? I think in the long 
run, promoting the resize grip to a real child widget is better.


If you fear compatibility problems, we could simply implement


an adjusted add() method which would force the resize grip to stay 


at the end (the simplest way to do it might be to remove the resize 
grip, add the new child, then put the resize grip back at the end...)




Ok to commit the patches with the changes you outlined ?


Comment 18 Owen Taylor 2003-06-04 15:14:36 UTC
You can't have an "adjusted add" function, because 
pack_start/pack_end, in GtkHBox aren't virtualized.

I'm wondering if my initial statusbar change was on
the wrong track, and whether the right fix was instead
to make get_grip_rect() use requisition width/height
rather than allocation width/height.

I think it's very unlikely that a statusbar will
get allocated taller than it's requisition, so 
I think making the grip rect's size equal to the
width of the requsition should be fine. If we didn't
do that, then we'd need width-for-height geometry 
management to get this right. 
Comment 19 Matthias Clasen 2003-07-30 20:20:33 UTC
Owen, looking again at this, I came across another problem with the
current resize grip implemenation: If the label in the statusbar is
made selectable, the resize grip becomes dysfunctional, since the
button presses are handled by the label and
gtk_statusbar_button_press() doesn't get called.

You may be right that turning the resize grip into a regular child
widget can't be done compatibly, so here is a compromise proposal:

Lets add a GtkResizeGrip widget, deprecate
gtk_statusbar_[gs]et_has_resize_grip(), but leave it there for 
compat reasons.
Comment 20 Soren Sandmann Pedersen 2003-07-30 21:13:30 UTC
The "adjusted add" I suggested originally was about creating a

       _gtk_hbox_add_at_end (GtkHbox *hbox, GtkWidget *child)

that would cause the HBox to always position child as the end of the hbox.

Not particularly nice; Matthias' compromise may be better.
Comment 21 Matthias Clasen 2003-07-31 20:53:25 UTC
Here is a first cut at GtkResizeGrip. The screenshot shows that using
a widget instead of drawing over the label is not 100% visually
compatible, but I think that is ok. There are examples for both
visuals on other platforms, e.g IE uses the old appearance, Excel the new.
Comment 22 Matthias Clasen 2003-07-31 20:54:19 UTC
Created attachment 18797 [details]
gtkresizegrip.h
Comment 23 Matthias Clasen 2003-07-31 20:54:58 UTC
Created attachment 18798 [details]
gtkresizegrip.c
Comment 24 Matthias Clasen 2003-07-31 20:55:27 UTC
Created attachment 18799 [details] [review]
testgtk patch
Comment 25 Matthias Clasen 2003-07-31 21:30:37 UTC
Created attachment 18800 [details]
screenshot
Comment 26 Soren Sandmann Pedersen 2003-07-31 23:03:26 UTC
Some comments:

    - How does this interact with RTL? Who is responsible for changing
      the window edge property when the widget gets moved to the other
      end of its container?

    - I think there should be style properties "width" and "height"
      (or at least a "size" property)

    - the string passed to "paint_resize_grip" should probably be
      "resize_grip", not "statusbar"

Unless of course this is to be internal-use API only, in which case
none of the comments above apply.
Comment 27 Matthias Clasen 2003-07-31 23:34:57 UTC
    - How does this interact with RTL? Who is responsible for changing
      the window edge property when the widget gets moved to the other
      end of its container?

The GtkResizeGrip does flipping on its own. If you set
edge = GDK_WINDOW_EGDGE_SOUTH_EAST and the text direction to RTL,
the effective edge is GDK_WINDOW_EDGE_SOUTH_WEST. See get_grip_edge().
You can test this in testgtk with the "flipping" example.

    - I think there should be style properties "width" and "height"
      (or at least a "size" property)

Should these control the size of the widget or only the size of the
drawn grip and the input window ?

    - the string passed to "paint_resize_grip" should probably be
      "resize_grip", not "statusbar"

Yes.
Comment 28 Matthias Clasen 2003-08-06 22:19:13 UTC
Created attachment 18977 [details]
new version
Comment 29 Owen Taylor 2003-08-25 21:53:18 UTC
To me, packing a GtkResizeGrip in just doesn't feel very natural;
I'm not sure I can quantify exactly why, possibly:

 A) Because it doesn't make much sense most places in the window
 B) Because it would be nice to keep flexibility for a 
    over-the-top GtkResizeGrip

Note also that I don't see how you aer going to make the GtkResizeGrip
widen as the statusbar gets taller with a separate widget, if
you do it as a separate widget.

I think I'd rather do it with some magic hidden GtkHBox API
then as a separate widget, though I'm not really convinced
you can't do it by simply overriding GtkSizeRequest/Allocate
for GtkHBox and chaining up.
Comment 30 Matthias Clasen 2004-03-10 10:13:48 UTC
It is pretty clear that this isn't ready for 2.4.0 at this point.
Comment 31 Soren Sandmann Pedersen 2004-03-13 21:37:22 UTC
*** Bug 137107 has been marked as a duplicate of this bug. ***
Comment 32 Luis Villa 2004-04-29 15:43:31 UTC
It feels like several of the patches in this bug could be marked obsolete or
needs-work but I'm not quite clear on the relationship between them all, so
perhaps someone could go through and do that who is more clear with the
situation. Just a though.
Comment 33 Elijah Newren 2004-06-19 18:44:53 UTC
Mass changing gtk+ bugs with target milestone of 2.4.2 to target 2.4.4, as
Matthias said he was trying to do himself on IRC and was asking for help with. 
If you see this message, it means I was successful at fixing the borken-ness in
bugzilla :)  Sorry for the spam; just query on this message and delete all
emails you get with this message, since there will probably be a lot.
Comment 34 Matthias Clasen 2004-11-09 14:51:39 UTC
I have fixed the clipping/overdraw problems now.