Ticket #640 (closed defect: invalid)

Opened 6 years ago

Last modified 6 years ago

MokoScrolledPane not able to scroll a gtkhtml Widget

Reported by: J.Schauer@… Owned by: buglog@…
Priority: high Milestone:
Component: Theming - Gtk+ Version: current svn head
Severity: trivial Keywords:
Cc: buglog@… Blocked By:
Blocking: Estimated Completion (week):
HasPatchForReview: PatchReviewResult:
Reproducible:

Description

I modified the Stylus Demo by Mickey and included a gtkhtml widget in the
MokoScrolledPane?* detailswindow instead of GtkLabel?* details.

The problem: the content of the gtkhtml widget displays its content but it is
not scrollable as the scrollbar is always at full height.

One workaround would be to specify the height of my gtkhtml widget with
gtk_widget_set_size_request but I think MokoScrolledPane? has to detect the
correct size by its own

If I replace MokoScrolledPane?* detailswindow = moko_scrolled_pane_new() with a
normal GtkScrolledWindow? and add my gtkhtml widget with
gtk_scrolled_window_add_with_viewport my gtkhtml widget is correctly scrolled
but I want to use MokoScrolledPane? because of the tiny fullscreen button.

I tried to put my gtkhtml widget into several different containers (viewport,
hbox) but nothing added the scroll functionality to MokoScrolledPane?. I could
embed my gtkhtml widget within a GtKScrolledWindow inside a MokoScrolledPane? but
this would only result in two seperate Scrollbars: the outer MokoScrolledPane?
Scrollbar not working and the inner one working as expected.

I had a look into the the MokoScrolledPane? implementation and saw that the
scrolling ability was disabled with gtk_scrolled_window_set_policy(
GTK_SCROLLED_WINDOW(priv->scrolledwindow), GTK_POLICY_NEVER, GTK_POLICY_NEVER );
But this obviously has to be so because the scrollbar and fullscreen button are
added manually later.

We see that MokoScrolledPane? can scroll a gtk_label corretly. Why can't it do so
with a gtkhtml widget - the GtkScrolledWindow? can!
I didn't look very deep into the openmoko code but I think that this is a
problem that has to be solved for further development with the openmoko gtk style.

Change History

comment:1 Changed 6 years ago by J.Schauer@…

Here is the code to reproduce this bug:

create the document
HtmlDocument? *document = html_document_new();

html_document_clear(document);
html_document_open_stream(document, "text/html");
html_document_write_stream(document, "", strlen(""));
html_document_close_stream(document);

create the gtkhtml widget and supply the document to it
GtkWidget? *view = html_view_new();
html_view_set_document( HTML_VIEW(view), document );

delete this line to let the scrollbar disappear
gtk_widget_set_size_request(view, -1, 1000);

use MokoScrolledPane? to display the widget
MokoScrolledPane?* detailswindow = moko_scrolled_pane_new();
moko_scrolled_pane_pack_with_viewport (MOKO_SCROLLED_PANE (detailswindow),
GTK_WIDGET(view) );

Just Insert some test html in html_document_write_stream. If you uncomment
gtk_widget_set_size_request it will no longer be scrollable.
As said before I also tried to pack the widget in different containers with no luck.

Here is the same code but without the use of MokoScrolledPane?:

create the document
HtmlDocument? *document = html_document_new();

html_document_clear(document);
html_document_open_stream(document, "text/html");
html_document_write_stream(document, "", strlen(""));
html_document_close_stream(document);

create the gtkhtml widget and supply the document to it
GtkWidget? *view = html_view_new();
html_view_set_document( HTML_VIEW(view), document );

use gtk_scrolled_window to display the widget
GtkWidget? *scrolledwindow = gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow),

GTK_POLICY_AUTOMATIC, TK_POLICY_ALWAYS);

gtk_container_add(GTK_CONTAINER(scrolledwindow), view);

And this works! I only changed the last two lines and replaced them with the gtk
widgets instead of the moko widgets.

comment:2 Changed 6 years ago by J.Schauer@…

  • Status changed from new to closed
  • Resolution set to invalid
  • Severity changed from normal to trivial

Okay... this is very embarrassing...
After looking deeper into /openmoko-libs/libmokoui/moko-scrolled-pane.c I
realized that I just had to use moko_scrolled_pane_pack instead of
moko_scrolled_pane_pack_with_viewport... and I tried for HOURS and used the
bugreport as my last ressort - sry, I should have more faith in you guys you are
really doing a GREAT job!

Note: See TracTickets for help on using tickets.