aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2021-12-29 18:06:34 +0800
committerPo Lu2021-12-29 18:06:34 +0800
commit9d1312d8e9bf78c12a94fa075cda3c8ad7d1dad7 (patch)
tree0b8af612540857b33a06e3f66233755ca9098585 /src
parent8719abe4ca5d4b6ccc0e405dc0313730c6ec7d72 (diff)
downloademacs-9d1312d8e9bf78c12a94fa075cda3c8ad7d1dad7.tar.gz
emacs-9d1312d8e9bf78c12a94fa075cda3c8ad7d1dad7.zip
Get rid of obsolete xwidget-related code on PGTK
* src/emacsgtkfixed.c (emacs_fixed_class_init): Stop setting obsolete methods. (EMACS_FIXED_GET_CLASS, struct GtkFixedPrivateL): (emacs_fixed_gtk_widget_size_allocate): Delete obsolete things. * src/xwidget.c (x_draw_xwidget_glyph_string): Work around mysterious bug.
Diffstat (limited to 'src')
-rw-r--r--src/emacsgtkfixed.c90
-rw-r--r--src/xwidget.c2
2 files changed, 2 insertions, 90 deletions
diff --git a/src/emacsgtkfixed.c b/src/emacsgtkfixed.c
index 7130e3535a7..bd365004ad6 100644
--- a/src/emacsgtkfixed.c
+++ b/src/emacsgtkfixed.c
@@ -27,7 +27,6 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
27#else 27#else
28#include "xterm.h" 28#include "xterm.h"
29#endif 29#endif
30#include "xwidget.h"
31#include "emacsgtkfixed.h" 30#include "emacsgtkfixed.h"
32 31
33/* Silence a bogus diagnostic; see GNOME bug 683906. */ 32/* Silence a bogus diagnostic; see GNOME bug 683906. */
@@ -63,92 +62,6 @@ EMACS_FIXED (GtkWidget *widget)
63 EmacsFixed); 62 EmacsFixed);
64} 63}
65 64
66#if defined HAVE_XWIDGETS && defined HAVE_PGTK
67
68static EmacsFixedClass *
69EMACS_FIXED_GET_CLASS (GtkWidget *widget)
70{
71 return G_TYPE_INSTANCE_GET_CLASS (widget, emacs_fixed_get_type (),
72 EmacsFixedClass);
73}
74
75struct GtkFixedPrivateL
76{
77 GList *children;
78};
79
80static void
81emacs_fixed_gtk_widget_size_allocate (GtkWidget *widget,
82 GtkAllocation *allocation)
83{
84 /* For xwidgets.
85
86 This basically re-implements the base class method and adds an
87 additional case for an xwidget view.
88
89 It would be nicer if the bse class method could be called first,
90 and the xview modification only would remain here. It wasn't
91 possible to solve it that way yet. */
92 EmacsFixedClass *klass;
93 GtkWidgetClass *parent_class;
94 struct GtkFixedPrivateL *priv;
95
96 klass = EMACS_FIXED_GET_CLASS (widget);
97 parent_class = g_type_class_peek_parent (klass);
98 parent_class->size_allocate (widget, allocation);
99
100 priv = G_TYPE_INSTANCE_GET_PRIVATE (widget, GTK_TYPE_FIXED,
101 struct GtkFixedPrivateL);
102
103 gtk_widget_set_allocation (widget, allocation);
104
105 if (gtk_widget_get_has_window (widget))
106 {
107 if (gtk_widget_get_realized (widget))
108 gdk_window_move_resize (gtk_widget_get_window (widget),
109 allocation->x,
110 allocation->y,
111 allocation->width,
112 allocation->height);
113 }
114
115 for (GList *children = priv->children; children; children = children->next)
116 {
117 GtkFixedChild *child = children->data;
118
119 if (!gtk_widget_get_visible (child->widget))
120 continue;
121
122 GtkRequisition child_requisition;
123 gtk_widget_get_preferred_size (child->widget, &child_requisition, NULL);
124
125 GtkAllocation child_allocation;
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 struct xwidget_view *xv
139 = g_object_get_data (G_OBJECT (child->widget), XG_XWIDGET_VIEW);
140 if (xv)
141 {
142 child_allocation.width = xv->clip_right;
143 child_allocation.height = xv->clip_bottom - xv->clip_top;
144 }
145
146 gtk_widget_size_allocate (child->widget, &child_allocation);
147 }
148}
149
150#endif /* HAVE_XWIDGETS && HAVE_PGTK */
151
152static void 65static void
153emacs_fixed_class_init (EmacsFixedClass *klass) 66emacs_fixed_class_init (EmacsFixedClass *klass)
154{ 67{
@@ -158,9 +71,6 @@ emacs_fixed_class_init (EmacsFixedClass *klass)
158 71
159 widget_class->get_preferred_width = emacs_fixed_get_preferred_width; 72 widget_class->get_preferred_width = emacs_fixed_get_preferred_width;
160 widget_class->get_preferred_height = emacs_fixed_get_preferred_height; 73 widget_class->get_preferred_height = emacs_fixed_get_preferred_height;
161#if defined HAVE_XWIDGETS && defined HAVE_PGTK
162 widget_class->size_allocate = emacs_fixed_gtk_widget_size_allocate;
163#endif
164 g_type_class_add_private (klass, sizeof (EmacsFixedPrivate)); 74 g_type_class_add_private (klass, sizeof (EmacsFixedPrivate));
165} 75}
166 76
diff --git a/src/xwidget.c b/src/xwidget.c
index 71a1a46d10b..671d0390a0b 100644
--- a/src/xwidget.c
+++ b/src/xwidget.c
@@ -2168,9 +2168,11 @@ x_draw_xwidget_glyph_string (struct glyph_string *s)
2168 covers the entire frame. Clipping might have changed even if we 2168 covers the entire frame. Clipping might have changed even if we
2169 haven't actually moved; try to figure out when we need to reclip 2169 haven't actually moved; try to figure out when we need to reclip
2170 for real. */ 2170 for real. */
2171#ifndef HAVE_PGTK
2171 if (xv->clip_right != clip_right 2172 if (xv->clip_right != clip_right
2172 || xv->clip_bottom != clip_bottom 2173 || xv->clip_bottom != clip_bottom
2173 || xv->clip_top != clip_top || xv->clip_left != clip_left) 2174 || xv->clip_top != clip_top || xv->clip_left != clip_left)
2175#endif
2174 { 2176 {
2175#ifdef USE_GTK 2177#ifdef USE_GTK
2176#ifdef HAVE_X_WINDOWS 2178#ifdef HAVE_X_WINDOWS