summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoakim@verona.se <>2011-07-04 20:32:20 +0200
committerjoakim@verona.se <>2011-07-04 20:32:20 +0200
commitc91b458025fdb9f2e84d6f9e241fc1959fbf10a7 (patch)
tree4c821830695cd38678377f2f07321f317320af37
parentf492d34828cd01d62874b381f031252bbdee8c06 (diff)
downloademacs-c91b458025fdb9f2e84d6f9e241fc1959fbf10a7.tar.gz
work on cliptop. swithched from viewport, back to gtkfixed. pretty acceptable visuals
-rw-r--r--README.xwidget3
-rw-r--r--src/emacsgtkfixed.c4
-rw-r--r--src/xwidget.c30
3 files changed, 11 insertions, 26 deletions
diff --git a/README.xwidget b/README.xwidget
index 5b2047165da..94d10fbbedf 100644
--- a/README.xwidget
+++ b/README.xwidget
@@ -566,6 +566,9 @@ viewport now and scroll it the amount that needs to be clipped.
however, the viewport is sensitive to changes in allocation, which
makes it harder to use the allocation workarounds.
+see:
+- gtk_widget_set_size_request
+- gtkscrolledwindow
** TODO use FRAME_GTK_WIDGET (f)
rather than gwfixed
diff --git a/src/emacsgtkfixed.c b/src/emacsgtkfixed.c
index 61d7898ce44..0eacd2eaa2d 100644
--- a/src/emacsgtkfixed.c
+++ b/src/emacsgtkfixed.c
@@ -59,8 +59,8 @@ void aloc_callback(GtkWidget* child, GtkWidget* fixed){
child_allocation.width = xv->clipx;
child_allocation.height = xv->clipy - xv->cliptop;
gtk_widget_size_allocate (child, &child_allocation);
- //TODO find a way to remove this fooble workaround
- gtk_adjustment_set_value (gtk_viewport_get_vadjustment(GTK_VIEWPORT(xv->widgetwindow)), 1.0*xv->cliptop);
+ //TODO find a way to remove this feeble workaround
+ //gtk_adjustment_set_value (gtk_viewport_get_vadjustment(GTK_VIEWPORT(xv->widgetwindow)), 1.0*xv->cliptop);
}
}
diff --git a/src/xwidget.c b/src/xwidget.c
index 00a10eefdd7..90c9f225c77 100644
--- a/src/xwidget.c
+++ b/src/xwidget.c
@@ -551,24 +551,22 @@ xwidget_init_view (
//xw->widgetwindow = GTK_CONTAINER (gtk_layout_new (NULL, NULL));
//xw->widgetwindow = GTK_CONTAINER (gtk_offscreen_window_new ());
- //xv->widgetwindow = GTK_CONTAINER (gtk_fixed_new ()); //works well for clipping on gtk2 not gtk3
+ xv->widgetwindow = GTK_CONTAINER (gtk_fixed_new ()); //works well for clipping on gtk2 not gtk3
//xv->widgetwindow = GTK_CONTAINER (gtk_event_box_new ()); //doesnt help clipping gtk3
//xv->widgetwindow = GTK_CONTAINER (gtk_scrolled_window_new (NULL, NULL)); //clips in gtk3
- xv->widgetwindow = GTK_CONTAINER (gtk_viewport_new (NULL, NULL));
+ //xv->widgetwindow = GTK_CONTAINER (gtk_viewport_new (NULL, NULL));
/* GtkAllocation a; */
/* a.x=0; a.y=0; a.width=xww->width; a.height=xww->height; */
/* gtk_widget_set_allocation (GTK_WIDGET (xv->widget), &a); */
- //gtk_widget_set_has_window(GTK_WIDGET ( xv->widgetwindow), TRUE);
- //if gtk_fixed doesnt have a window it will surprisingly not honor
+ gtk_widget_set_has_window(GTK_WIDGET ( xv->widgetwindow), TRUE);
+ //on GTK2 if gtk_fixed doesnt have a window it will surprisingly not honor
//setsize so that children gets clipped later. the documentation is
//not consistent regarding if its legal to call this method.
- //doesnt help on gtk3, and the docs seem clearer there that this is
- //an internal function
-
+ //on GTK3 the call isnt necessary except for windowless widgets such as the drawarea used for the webkit views
//gtk_layout_set_size (GTK_LAYOUT (xw->widgetwindow), xw->width, xw->height);
@@ -672,24 +670,8 @@ x_draw_xwidget_glyph_string (struct glyph_string *s)
//an emacs window is not a gtk window, a gtk window covers the entire frame
//cliping might have changed even if we havent actualy moved, we try figure out when we need to reclip for real
if((xv->clipx != clipx) || (xv->clipy != clipy)|| (xv->cliptop != cliptop)){
- printf("adj max:%f val:%f\n", gtk_adjustment_get_upper(gtk_viewport_get_vadjustment(GTK_VIEWPORT(xv->widgetwindow))), gtk_adjustment_get_value(gtk_viewport_get_vadjustment(GTK_VIEWPORT(xv->widgetwindow))));
gtk_widget_set_size_request (GTK_WIDGET (xv->widgetwindow), clipx, clipy + cliptop);
- printf("adj max:%f val:%f\n", gtk_adjustment_get_upper(gtk_viewport_get_vadjustment(GTK_VIEWPORT(xv->widgetwindow))), gtk_adjustment_get_value(gtk_viewport_get_vadjustment(GTK_VIEWPORT(xv->widgetwindow))));
-
- gtk_adjustment_set_value (gtk_viewport_get_vadjustment(GTK_VIEWPORT(xv->widgetwindow)), 1.0*cliptop);
- //gtk_adjustment_value_changed (gtk_viewport_get_vadjustment(GTK_VIEWPORT(xv->widgetwindow)));
-
- printf("adj max:%f val:%f\n", gtk_adjustment_get_upper(gtk_viewport_get_vadjustment(GTK_VIEWPORT(xv->widgetwindow))), gtk_adjustment_get_value(gtk_viewport_get_vadjustment(GTK_VIEWPORT(xv->widgetwindow))));
- /* gtk_adjustment_configure (gtk_viewport_get_vadjustment(GTK_VIEWPORT(xv->widgetwindow)), */
- /* - cliptop, //val */
- /* - xww->height, //max */
- /* 0.0, //low */
-
- /* 1.0, //step. unused */
- /* 1.0, //page step. unused */
- /* xww->height //page height */
-
- /* ); */
+ gtk_fixed_put(GTK_FIXED(xv->widgetwindow), xv->widget, 0, -cliptop);
printf("reclip %d %d -> %d %d cliptop:%d\n",xv->clipx, xv->clipy, clipx, clipy, cliptop );
//allocation debugging. the correct values cant be expected to show upp immediately, but eventually they should get to be ok