GNOME Bugzilla – Bug 96632
Support RTL flipping for hpaned
Last modified: 2011-02-04 16:16:03 UTC
the children should be exchanged in RTL mode.
Moving all the RTL flipping bugs to the 2.4.0 milestone; in some cases the changes should be easy to do. (GtkPaned comes to mind) In those cases, we can move the bugs back to 2.2.0 if patches occur.
Actually, hpaned turned out to be one of the hardest so far, since a good part of the position calculation is done in paned.c and shared with vpaned. In the end, I had to enhance gtk_paned_compute_position () to support flipping child1 and child2 by adding a new boolean parameter. This should not count as an api change, however, since gtk_paned_compute_position is an internal function (which should really be named _gtk_paned_compute_position and not be exported at all).
Created attachment 11901 [details] [review] patch
Can't you compute the inverted parameter using paned->orientation and gtk_widget_get_direction()? (The "encapsulation" of the orientation in the subclasses is already incomplete.)
Yes, I could. If I would have been totally confused by hpaned->orientation being vertical...new patch coming
Created attachment 11974 [details] [review] less invasive patch
It definitely bothers me that in this patch, when the hpaned is flipped, paned->child1_size refers to the size of paned->child2. Not only that, but the effect of gtk_paned_set_position() will be wrong if it effects the size of the left pane not the size of pane1. I think it would all come out a whole lot cleaner if the child1_size is left the size of child 1, and flipping is done: - When getting event coordinates (update_drag(), gtk_paned_button_press()) - When allocating the children gtk_hpaned_size_allocate() - it should be possible to add helper functions: compute_screen_rectangle (paned, &unflipped_rectangle); allocate_child (paned, child, &unflipped_allocation); and do it pretty cleanly.
Removing PATCH since the attached patch is not acceptable and I have not been able to produce a better one, despite several attempts. Owen, since you think this is simple, maybe you could give it a try...
Created attachment 20096 [details] [review] patch
- I did it pretty much as Owen suggested, except that flipping was not necessary in the button_press() handler. - It is not necessary to flip during f6 and f8 navigation because these routines selects the handles to activate based on child1/child2, not on aboslute position.
Looks plausible; if it works, I'd say commit it.
Fri Sep 19 18:15:31 2003 Soeren Sandmann <sandmann@daimi.au.dk> * gtk/gtkpaned.c, gtk/gtkhpaned.c: implement RTL flipping (#96632)