diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/emacsgtkfixed.c | 120 | ||||
| -rw-r--r-- | src/xwidget.c | 2 |
2 files changed, 97 insertions, 25 deletions
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); |
| 43 | G_DEFINE_TYPE (EmacsFixed, emacs_fixed, GTK_TYPE_FIXED) | 43 | G_DEFINE_TYPE (EmacsFixed, emacs_fixed, GTK_TYPE_FIXED) |
| 44 | 44 | ||
| 45 | void 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 | |||
| 65 | struct GtkFixedPrivateL | ||
| 66 | { | ||
| 67 | GList *children; | ||
| 68 | }; | ||
| 64 | 69 | ||
| 65 | static void emacs_fixed_gtk_widget_size_allocate (GtkWidget *widget, | 70 | static 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? |