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 741394 - GocCanvas as child of GtkScrolledWindow doesn't implement proper scrolling
GocCanvas as child of GtkScrolledWindow doesn't implement proper scrolling
Status: RESOLVED FIXED
Product: libgoffice
Classification: Other
Component: Canvas
0.10.x
Other Linux
: Normal major
: ---
Assigned To: Jean Bréfort
Jean Bréfort
Depends on:
Blocks:
 
 
Reported: 2014-12-11 13:29 UTC by j_deutsch
Modified: 2015-01-07 14:43 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GocItems overlap but scrolledwindow doesn't respond accordingly (18.36 KB, image/png)
2014-12-11 13:29 UTC, j_deutsch
  Details
patch (1.05 KB, patch)
2015-01-05 17:07 UTC, Jean Bréfort
committed Details | Review

Description j_deutsch 2014-12-11 13:29:57 UTC
Created attachment 292532 [details]
GocItems overlap but scrolledwindow doesn't respond accordingly

Dear developers,
Comment 1 j_deutsch 2014-12-11 13:36:53 UTC
Dear developers,

i added a GocCanvas instance to a GtkScrolledWindow. After drawing on the canvas the scrolled window doesn't respond correctly by showing the proper scrollbars. Unfortunately if the size of the corresponding GtkWindow is reduced some items on the canvas are inaccessible (you see that in the attached file). 

Considering that GocCanvas implements GtkScrollable this seems to be a major bug.

Best regards
Comment 2 Jean Bréfort 2014-12-11 13:43:50 UTC
The widget size and the canvas size are two different things for GocCanvas. A Gtk+ widget use integers for its size, but this is not large enough for gnumeric (in some rare cases though) unless the integers are 64 bits integers. You need to change the widget requisition after each canvas modification.
Comment 3 j_deutsch 2014-12-11 14:05:52 UTC
Thank you for your fast response.

Since i'm very new to goffice it's however somewhat diffuse to me.

For instance, if i adjust the size of the layout with

       gtk_layout_set_size(GTK_LAYOUT(canvas)), width, height);

and width and height are big enough scrollbars appear. Unfortunately if i scroll that doesn't result in scrolling the content of the canvas.

Or have i just taken the references to seriously with respect to the implementation of the GtkScrollable interface. Which means that i have to adapt the GocCanvas to the scrolled window by hand i.e. subclassing it and take a look into the details? By saying that you can maybe tell me how other applications manage that?
Comment 4 Jean Bréfort 2014-12-11 14:30:19 UTC
OK, I was not clear enough. GocCanvas does not really implements GtkScrollable (it is only implemented through GtkLayout). I would say it should scroll when the GtkLayout is large enough, but apparently it does not, which I find quite weird.

In gnumeric, we don't use a scrolled window. We just use two scrollbars and use goc_canvas_scroll_to() to show the correct region.
Comment 5 j_deutsch 2014-12-11 15:14:30 UTC
Thank you for your response. Especially the second paragraph makes sense.

I will try to do it this way.

Maybe you can tell me where the exact location inside the gnumeric code where the scrolling mechanism takes place?

Thanks in advance
Comment 6 Jean Bréfort 2014-12-11 16:07:42 UTC
The code is in sheet-control-gui.c. The functions are gnm_pane_set_top_left() (line 870) and friends.
Comment 7 j_deutsch 2014-12-12 21:47:31 UTC
Thanks a lot I will look into it..
Comment 8 Jean Bréfort 2014-12-13 07:51:56 UTC
Anyway, this might be easily fixed.
Comment 9 Jean Bréfort 2015-01-05 17:07:33 UTC
Created attachment 293843 [details] [review]
patch

This would fix the bug if needed.