aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoakim Verona2011-07-27 11:34:17 +0200
committerJoakim Verona2011-07-27 11:34:17 +0200
commit0527c8f155cf94a1f6db9bd84b1d86501259a332 (patch)
tree38589da0a3e92ff8681fda0897b8a7d47c20d593
parent460c547e0d83da81e503fe475f168c168850f49b (diff)
downloademacs-0527c8f155cf94a1f6db9bd84b1d86501259a332.tar.gz
emacs-0527c8f155cf94a1f6db9bd84b1d86501259a332.zip
futile allocation hacks
-rw-r--r--README.xwidget9
-rw-r--r--src/emacsgtkfixed.c120
-rw-r--r--src/xwidget.c2
3 files changed, 106 insertions, 25 deletions
diff --git a/README.xwidget b/README.xwidget
index e5b0d1fb211..2ece8bdccea 100644
--- a/README.xwidget
+++ b/README.xwidget
@@ -949,6 +949,10 @@ to see the problem surface to http://www.slashdot.org
949and then try resizing Epiphany. 949and then try resizing Epiphany.
950 950
951*** TODO xwidget webkit allow loading from string from emacs 951*** TODO xwidget webkit allow loading from string from emacs
952*** TODO C-X b in other buffer from webkit
953bafflingly resets the webkit view to the top. Maybe the window
954reconfiguration hook code? further mystification is added because it
955only seems to happen with ido mode enabled.
952** socket related 956** socket related
953*** TODO some flickering during redisplay of sockets 957*** TODO some flickering during redisplay of sockets
954with gtk3 an size allocation workaround is used. 958with gtk3 an size allocation workaround is used.
@@ -961,6 +965,11 @@ allocation then modifying the results. its done this way to minimise
961the copy paste index from the base class. it might be that the 965the copy paste index from the base class. it might be that the
962original allocation has a brief time window to show itself. 966original allocation has a brief time window to show itself.
963 967
968tried to modify the allocation hack so it doesn't call allocate
969twice. this doesn't seem to help flicker at all aparently so the
970hypothesis falls. Maybe then a socket simply doesn't lke being clipped
971by gtkfixed.
972
964*** TODO xwidget view reaping too agressive 973*** TODO xwidget view reaping too agressive
965hide an emacs window for a while and return to it. the xwidget might 974hide an emacs window for a while and return to it. the xwidget might
966get reaped and a new socket thus created. 975get reaped and a new socket thus created.
diff --git a/src/emacsgtkfixed.c b/src/emacsgtkfixed.c
index 637903d85b4..9b10957f583 100644
--- a/src/emacsgtkfixed.c
+++ b/src/emacsgtkfixed.c
@@ -42,43 +42,115 @@ static void emacs_fixed_get_preferred_height (GtkWidget *widget,
42 gint *natural); 42 gint *natural);
43G_DEFINE_TYPE (EmacsFixed, emacs_fixed, GTK_TYPE_FIXED) 43G_DEFINE_TYPE (EmacsFixed, emacs_fixed, GTK_TYPE_FIXED)
44 44
45void aloc_callback(GtkWidget* child, GtkWidget* fixed){ 45/* void aloc_callback(GtkWidget* child, GtkWidget* fixed){ */
46 GtkAllocation child_allocation; 46/* GtkAllocation child_allocation; */
47 GtkRequisition child_requisition; 47/* GtkRequisition child_requisition; */
48 48
49 //TODO 49/* //TODO */
50 // if child is an xwidget, find its clipping area and modify allocation 50/* // if child is an xwidget, find its clipping area and modify allocation */
51 51
52 struct xwidget_view* xv = (struct xwidget_viev*) g_object_get_data (G_OBJECT (child), XG_XWIDGET_VIEW); 52/* struct xwidget_view* xv = (struct xwidget_viev*) g_object_get_data (G_OBJECT (child), XG_XWIDGET_VIEW); */
53 printf("aloc callback %d %s\n", xv, gtk_widget_get_name(child)); 53/* printf("aloc callback %d %s\n", xv, gtk_widget_get_name(child)); */
54 if(xv){ 54/* if(xv){ */
55 printf(" allocation modification for xw\n"); 55/* printf(" allocation modification for xw\n"); */
56 gtk_widget_get_allocation(child, &child_allocation); 56/* gtk_widget_get_allocation(child, &child_allocation); */
57 child_allocation.width = xv->clip_right; 57/* child_allocation.width = xv->clip_right; */
58 child_allocation.height = xv->clip_bottom - xv->clip_top; 58/* child_allocation.height = xv->clip_bottom - xv->clip_top; */
59 gtk_widget_size_allocate (child, &child_allocation); 59/* gtk_widget_size_allocate (child, &child_allocation); */
60 //TODO find a way to remove this feeble workaround 60/* //TODO find a way to remove this feeble workaround */
61 } 61/* } */
62 62
63} 63/* } */
64
65struct GtkFixedPrivateL
66{
67 GList *children;
68};
64 69
65static void emacs_fixed_gtk_widget_size_allocate (GtkWidget *widget, 70static void emacs_fixed_gtk_widget_size_allocate (GtkWidget *widget,
66 GtkAllocation *allocation){ 71 GtkAllocation *allocation){
67 //for xwidgets 72 //for xwidgets
68 printf(" emacs_fixed_gtk_widget_size_allocate\n"); 73
69 74
70 //TODO 1st call base class method 75 //TODO 1st call base class method
71 EmacsFixedClass *klass; 76 EmacsFixedClass *klass;
72 GtkWidgetClass *parent_class; 77 GtkWidgetClass *parent_class;
78 struct GtkFixedPrivateL* priv;
79
80 printf(" emacs_fixed_gtk_widget_size_allocate\n");
73 klass = EMACS_FIXED_GET_CLASS (widget); 81 klass = EMACS_FIXED_GET_CLASS (widget);
74 parent_class = g_type_class_peek_parent (klass); 82 parent_class = g_type_class_peek_parent (klass);
75 parent_class->size_allocate (widget, allocation); 83 parent_class->size_allocate (widget, allocation);
76 84
77 85 priv = G_TYPE_INSTANCE_GET_PRIVATE (widget,
86 GTK_TYPE_FIXED,
87 struct GtkFixedPrivateL);
88 //fixed->priv = G_TYPE_INSTANCE_GET_PRIVATE (fixed, GTK_TYPE_FIXED, GtkFixedPrivate);
78 //then modify allocations 89 //then modify allocations
79 gtk_container_foreach (widget, 90 /* gtk_container_foreach (widget, */
80 aloc_callback, 91 /* aloc_callback, */
81 widget); 92 /* widget); */
93
94 //begin copy paste extravaganza!!!
95
96 //GtkFixed *fixed = GTK_FIXED (widget);
97 //GtkFixedPrivate *priv = fixed->priv;
98 GtkFixedChild *child;
99 GtkAllocation child_allocation;
100 GtkRequisition child_requisition;
101 GList *children;
102
103
104 gtk_widget_set_allocation (widget, allocation);
105
106 if (gtk_widget_get_has_window (widget))
107 {
108 if (gtk_widget_get_realized (widget))
109 gdk_window_move_resize (gtk_widget_get_window (widget),
110 allocation->x,
111 allocation->y,
112 allocation->width,
113 allocation->height);
114 }
115
116 for (children = priv->children;
117 children;
118 children = children->next)
119 {
120 child = children->data;
121
122 if (!gtk_widget_get_visible (child->widget))
123 continue;
124
125 gtk_widget_get_preferred_size (child->widget, &child_requisition, NULL);
126 child_allocation.x = child->x;
127 child_allocation.y = child->y;
128
129 if (!gtk_widget_get_has_window (widget))
130 {
131 child_allocation.x += allocation->x;
132 child_allocation.y += allocation->y;
133 }
134
135 child_allocation.width = child_requisition.width;
136 child_allocation.height = child_requisition.height;
137
138
139
140 struct xwidget_view* xv = (struct xwidget_viev*) g_object_get_data (G_OBJECT (child->widget), XG_XWIDGET_VIEW);
141 //printf("aloc callback %d %s\n", xv, gtk_widget_get_name(child));
142 if(xv){
143 //gtk_widget_get_allocation(child, &child_allocation);
144 child_allocation.width = xv->clip_right;
145 child_allocation.height = xv->clip_bottom - xv->clip_top;
146 //gtk_widget_size_allocate (child, &child_allocation);
147 //TODO find a way to remove this feeble workaround
148 printf(" allocation internal modification for xw %d %d,%d\n",xv, child_allocation.width, child_allocation.height);
149
150 }
151 gtk_widget_size_allocate (child->widget, &child_allocation);
152
153 }
82 154
83} 155}
84 156
diff --git a/src/xwidget.c b/src/xwidget.c
index f1c4e0e35cb..c8e025db579 100644
--- a/src/xwidget.c
+++ b/src/xwidget.c
@@ -603,7 +603,7 @@ x_draw_xwidget_glyph_string (struct glyph_string *s)
603 //this happens when an emacs window border moves across a widget winow 603 //this happens when an emacs window border moves across a widget winow
604 moved = (xv->x + xv->clip_left != x+clip_left) 604 moved = (xv->x + xv->clip_left != x+clip_left)
605 || ((xv->y + xv->clip_top)!= (y+clip_top)); 605 || ((xv->y + xv->clip_top)!= (y+clip_top));
606 //if(moved) printf ("live xwidget moved: id:%d (%d,%d)->(%d,%d) y+clip_top:%d\n", xww->id, xv->x, xv->y, x, y, y + clip_top); 606 if(moved) printf ("lxwidget moved: id:%d (%d,%d)->(%d,%d) y+clip_top:%d\n", xww, xv->x, xv->y, x, y, y + clip_top);
607 xv->x = x; 607 xv->x = x;
608 xv->y = y; 608 xv->y = y;
609 if (moved) //has it moved? 609 if (moved) //has it moved?